Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within C / C++
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
C / C++
C2143 error and I can't find it
theodore sklavenitis
Greenhorn
Posts: 4
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
#include<stdio.h> #include<malloc.h> void Arrive(); void Leave(); void print(); void menu(); struct node { int info; struct node *link; } *new,*temp,*p,*front=NULL,*rear=NULL; typedef struct node N; int main(void) { int x, result,item; char option[10]; menu(); scanf("%s", option); while (strcmp(option, "exit") != 0) { if (strcmp(option, "Arrive") == 0) { Arrive(); } else if (strcmp(option, "Leave") == 0) { Leave(); } if (strcmp(option, "search") == 0) { printf("Enter Registration Number Please\n"); scanf("%d", &x); } else if (strcmp(option, "print") == 0) { print(); } else if (strcmp(option, "Front") ==0) { } else if (strcmp(option, "Back") ==0) { } menu(); scanf("%s", option); } return 0; } // void Arrive() { int item; new=(N*)malloc(sizeof(N)); printf("\nEnter the item : "); scanf("%d",&item); new->info=item; new->link=NULL; if(front==NULL) front=new; else rear->link=new; rear=new; } void Leave() { if(front==NULL) printf("\nQueue is empty"); else { p=front; printf("\nDeleted element is : %d",p->info); front=front->link; free(p); } } void print() { if(front==NULL) printf("\nQueue is empty"); else { printf("\nThe elements are : "); temp=front; } while(temp!=NULL) { printf("%d",temp->info); temp=temp->link; } void menu() { printf("Enter one of the following\n"); printf("1 - Arrive\n"); printf("2 - Leave\n"); printf("3 - search\n"); printf("4 - print\n"); printf("5 - Front\n"); printf("6 - Back\n"); printf("7 - exit\n"); }
Compiler tells me that i have a C2143 error on line 112 and after looking at it for hours i cant figure it out.Anyone has any idea what the problem might be
theodore sklavenitis
Greenhorn
Posts: 4
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
NVM got it.Damn braces
Campbell Ritchie
Marshal
Posts: 80940
521
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Was it line 92? That compiler obviously can't count.
Dragos Nica
Ranch Hand
Posts: 39
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Campbell Ritchie wrote:
Was it line 92? That compiler obviously can't count.
I think it was at line 107, closing bracket for function print()
SCJP 6.0 (88%)
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Linked List Sorting Problems
Linked List Sorting Problem
fgets and fscanf
Linked List
need linked list help :-)
More...