Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

c question

This is a discussion on c question within the C and C++ forums, part of the Software Development category; where does function declerations and func definations gets memory/stored? where does 'printf()' definations stored?...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 09-12-2009
Junior Member
 
Join Date: Sep 2009
Location: bangalore
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
karkeraashwith is on a distinguished road
Post c question

where does function declerations and func definations gets memory/stored?
where does 'printf()' definations stored?
Reply With Quote
The Following User Says Thank You to karkeraashwith For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 09-12-2009
Expert Member
 
Join Date: May 2009
Location: Bangalore
Posts: 983
Thanks: 155
Thanked 420 Times in 201 Posts
rijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nice
Re: c question

Quote:
Originally Posted by karkeraashwith View Post
where does function declerations and func definations gets memory/stored?
where does 'printf()' definations stored?
Hi karkeraashwith,

Function decleration stored in .obj & function definition stored in .h & printf definition stored in .libc.

Thanks,
Riju.

Last edited by rijus; 09-12-2009 at 05:28 AM.
Reply With Quote
  #3 (permalink)  
Old 09-18-2009
Junior Member
 
Join Date: Apr 2008
Location: Hyderabad
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
pavan.mustyala is on a distinguished road
Re: c question

Quote:
Originally Posted by rijus View Post
Hi karkeraashwith,

Function decleration stored in .obj & function definition stored in .h & printf definition stored in .libc.

Thanks,
Riju.
Both DECLARATION : AND DEFINITION go into the text section in memory, after a C program is compilled and linked.
In general , function declarations will be in .h files, and function definitions will go into .c files.
During compillation , when the compiller comes across statement of the function call , it checks the function declarations(proto types) which will be used for validation. If there is type mis-match, error will be thrown.

Coming to printf: It is standard library function. If static linkage is used, then the linker copies all library functions(here printf) used in the program into the executable image. If dynamic linkage is used, only link to shared library will be placed in the executable image.
Reply With Quote
  #4 (permalink)  
Old 09-20-2009
Junior Member
 
Join Date: Sep 2009
Location: gwalior
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
vinodtamdi is on a distinguished road
Re: c question

how to delete an element in between a linked list?
Reply With Quote
  #5 (permalink)  
Old 09-29-2009
Expert Member
 
Join Date: Dec 2006
Location: Chennai
Posts: 203
Thanks: 2
Thanked 17 Times in 15 Posts
Barbie is on a distinguished road
Re: c question

If you want to delete the first element, make the pointer.head(this points to the beginning of the linked list) pointer to point to the second element.

pointer.head = pointer.next

If you want to delete the last element, set the pointer.next(this points to the next element of the linked list) pointer of the last but second element to NULL.

p = pointer.head;
while (p != NULL)
{
p = p.next;
if p = NULL
{
q = NULL;
break;
}
q = p;
}

If you want to delete any other element, make the pointer.next(this points to the previous element of the linked list) pointer to point to the next element in the list.
Reply With Quote
  #6 (permalink)  
Old 10-18-2009
Junior Member
 
Join Date: Oct 2009
Location: Hapur
Posts: 6
Thanks: 0
Thanked 2 Times in 2 Posts
amitgupta_knmiet is on a distinguished road
Re: c question

printf() defination stored in <stdio.h> library or we say header ile

amit gupta
Reply With Quote
The Following User Says Thank You to amitgupta_knmiet For This Useful Post:
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Question shitalpatil Brainteasers 6 06-26-2009 04:37 AM
question jayanth511 SQL 5 11-04-2008 07:52 AM
Question Manoj.Oracle Oracle Apps 2 03-10-2008 08:54 AM
Question padmakrishna Java 0 01-22-2008 04:04 PM
c question..? kamanianil C and C++ 0 08-07-2007 06:30 AM


All times are GMT -4. The time now is 09:43 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved