473,320 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

what is the problem in this code?

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. struct Node
  4. {
  5.     int data;
  6.     struct Node *add;
  7. };
  8. void insert(struct Node **,int );
  9. void main()
  10. {
  11.     int pos,value;
  12.     struct Node* head=NULL; struct Node *point;
  13.     insert(&head,10);
  14.     insert(&head,20);
  15.     insert(&head,30);
  16.     insert(&head,40);
  17.     insert(&head,50);
  18.     insert(&head,60);
  19.     insert(&head,70);
  20.     insert(&head,80);
  21.     insert(&head,90);
  22.     insert(&head,100);
  23.     printf("Enter the position from the last to be displayed:");
  24.     scanf("%d",&pos);
  25.     point=display_nth(head);
  26.     value=point->data;
  27.     printf("\n%dth value for nth node is %d",pos,value);
  28.     display(head);
  29. }
  30. insert(struct Node** ref_head,int new_data)
  31. {
  32.     struct Node* temp=(struct Node*)malloc(sizeof(struct Node));
  33.     temp->data=new_data;
  34.     temp->add=(*ref_head);
  35.     (*ref_head)=temp;
  36. }
  37.  
31 1 C:\Users\GARIMA\Documents\nth from last.c [Warning] conflicting types for 'insert' [enabled by default]
8 6 C:\Users\GARIMA\Documents\nth from last.c [Note] previous declaration of 'insert' was here
C:\Users\GARIMA\AppData\Local\Temp\ccqujr3n.o nth from last.c:(.text+0x116): undefined reference to `display'
C:\Users\GARIMA\Documents\collect2.exe [Error] ld returned 1 exit status
Sep 23 '18 #1
1 1169
weaknessforcats
9,208 Expert Mod 8TB
In the function prototype insert() returns void.

In the function definition insert() return int.

oops.

When the return type is not specified, it defaults to int.

BTW: main() returns int. Not void. main() is the only function that returns int and you don't need a return statement.
Sep 23 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: PDXWilliam | last post by:
Hello, Please forgive if this is off-topic ... and I'd welcome if someone pointed me elsewhere to find this info. I'm programmatically retrieving data from a website and am unable to figure...
9
by: Mike L | last post by:
I tried a sample of code in MSDN magazine, but now I'm stuck. What code has the best performance to populate a Data Grid with a SP? Below is the code I have, which might be completing the wrong...
0
by: VM | last post by:
I have a pretty big application made in C but I only want to view the code that's being executed when a button in a toolbar is clicked. Since I didn't write the program, is there an easy way to...
1
by: Mateusz Rajca | last post by:
Hello, What code should I write to hide the taskbar? Mateusz
2
by: mistral | last post by:
what code encoded in this snippet? <script language=JavaScript>function dc(x){var...
1
by: bb nicole | last post by:
What coding should i have if i want to display all the latest job(according to date) which call out from database. For example, all today will display in the website... What code should i have to...
0
by: sheenaa | last post by:
Hi Everyone, I m using ASP.NET 2005 with C# and SQL SERVER 2005. I m using stored procedure and sql datasource control to retrieve the data. I want to use the trigger...
1
by: Ninoy | last post by:
I am doing a program in vb 6.0 what code will i use in order to separate date and time in listview and move the time in the next column and also how can i do a loop with it so that the last date and...
2
by: Joseph VH | last post by:
hello What code do I need to use on my Form to add background music and where do I put It. I think I have to put it in Joseph
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.