Click here to Skip to main content
15,894,410 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Pointer indirection Pin
Mircea Neacsu14-Sep-23 4:31
Mircea Neacsu14-Sep-23 4:31 
GeneralRe: Pointer indirection Pin
Calin Negru14-Sep-23 9:40
Calin Negru14-Sep-23 9:40 
GeneralRe: Pointer indirection Pin
jschell14-Sep-23 10:50
jschell14-Sep-23 10:50 
GeneralRe: Pointer indirection Pin
Calin Negru14-Sep-23 20:55
Calin Negru14-Sep-23 20:55 
GeneralRe: Pointer indirection Pin
k505414-Sep-23 4:32
mvek505414-Sep-23 4:32 
AnswerRe: Pointer indirection Pin
Richard MacCutchan14-Sep-23 5:43
mveRichard MacCutchan14-Sep-23 5:43 
GeneralRe: Pointer indirection Pin
Calin Negru14-Sep-23 9:10
Calin Negru14-Sep-23 9:10 
GeneralRe: Pointer indirection Pin
Richard MacCutchan14-Sep-23 21:12
mveRichard MacCutchan14-Sep-23 21:12 
Question[edited] collision response in a RTS Pin
Calin Negru28-Aug-23 6:49
Calin Negru28-Aug-23 6:49 
AnswerRe: [edited] collision response in a RTS Pin
Randor 28-Aug-23 8:48
professional Randor 28-Aug-23 8:48 
GeneralRe: [edited] collision response in a RTS Pin
Calin Negru29-Aug-23 0:41
Calin Negru29-Aug-23 0:41 
GeneralRe: [edited] collision response in a RTS Pin
Randor 29-Aug-23 5:24
professional Randor 29-Aug-23 5:24 
AnswerRe: [edited] collision response in a RTS Pin
Gerry Schmitz30-Aug-23 10:52
mveGerry Schmitz30-Aug-23 10:52 
GeneralRe: [edited] collision response in a RTS Pin
Calin Negru31-Aug-23 6:05
Calin Negru31-Aug-23 6:05 
GeneralRe: [edited] collision response in a RTS Pin
Gerry Schmitz1-Sep-23 6:26
mveGerry Schmitz1-Sep-23 6:26 
GeneralRe: [edited] collision response in a RTS Pin
Calin Negru2-Sep-23 7:35
Calin Negru2-Sep-23 7:35 
GeneralRe: [edited] collision response in a RTS Pin
Gerry Schmitz3-Sep-23 5:30
mveGerry Schmitz3-Sep-23 5:30 
QuestionDSA Pin
ZAID razvi25-Aug-23 0:50
ZAID razvi25-Aug-23 0:50 
AnswerRe: DSA Pin
CPallini25-Aug-23 1:36
mveCPallini25-Aug-23 1:36 
GeneralRe: DSA Pin
ZAID razvi25-Aug-23 1:54
ZAID razvi25-Aug-23 1:54 
GeneralRe: DSA Pin
CPallini25-Aug-23 2:10
mveCPallini25-Aug-23 2:10 
GeneralRe: DSA Pin
ZAID razvi25-Aug-23 4:57
ZAID razvi25-Aug-23 4:57 
How is that possible sir! Second code is written by a renowned youtuber 'code_with_harry'. Okk, for your better understanding i'm pasting full source code here:


#include <stdio.h>
#include <stdlib.h>

struct Node *f = NULL;
struct Node *r = NULL;

struct Node{
int data;
struct Node *next;
};
void traversal(struct Node *f){
struct Node *ptr=f;
printf("------------\n");
while(ptr!=NULL){
printf("%d ",ptr->data);
ptr=ptr->next;
}
printf("\n------------\n");
}
int isEmpty(struct Node *f){
if (f == NULL){
return 1;
}
return 0;
}
int isFull(struct Node *f){
struct Node *n = (struct Node *)malloc(sizeof(struct Node));
if (n == NULL){
return 1;
}
return 0;
}
struct Node *enqueue(int val){
if (isFull(f)){
printf("Queue Overflow! Can't Enqueue %d\n", val);
return f;
}
else{
struct Node *n = (struct Node *)malloc(sizeof(struct Node));
n->data = val;
n->next = NULL;
if (isEmpty(f)){
f = r = n;
}
r->next = n;
r = n;
return f;
}
}
// int dequeue(){
// if (isFull(f)){
// printf("Queue Underflow! Nothing to Dequeue");
// }
// int dqd = f->data;
// f = f->next;
// return dqd;
// }
int dequeue(){
int val=-1;
struct Node *ptr=f;
if (f==NULL){
printf("Empty\n");
}
else{
f=f->next;
val=ptr->data;
free(ptr);
return val;
}
}
int main(){

enqueue(11);
enqueue(22);
enqueue(33);
enqueue(44);
traversal(f);

dequeue();
dequeue();
traversal(f);

return 0;
}
GeneralRe: DSA Pin
Richard Deeming28-Aug-23 21:34
mveRichard Deeming28-Aug-23 21:34 
GeneralRe: DSA Pin
ZAID razvi28-Aug-23 21:52
ZAID razvi28-Aug-23 21:52 
GeneralRe: DSA Pin
Andre Oosthuizen29-Aug-23 2:41
mveAndre Oosthuizen29-Aug-23 2:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.