Tuesday, July 14, 2009

Hey, please help me with some questions about C-Program!?

1) What are the header files in the C-Program?


2) What does "printf" do?


3) What does "scanf" do?


4) What are the data types in C-Languages?





This is for an assignment...





If possible, kindly include a site for my further info. Thanks a lot!

Hey, please help me with some questions about C-Program!?
1. header files are those files that hold the declarations of some of the functions and variables(and hence called "Pre-defined functions"). Those functions are put under different headers based on their function. Since those ".h" files are included usually at the top of a program file, they are referred to as "header files"





2. printf, a function under stdio.h(standard I/O header), prints a string- a raw string or values of variables - represented as format specifiers. it returns the total number of characters printed on to the standard console(Usually, the monitor)





3. scanf, a counterpart of printf, scans (or reads) values mentioned using format specifiers, from the stand console.(E.g. Key board). this too retrurns an integer, the total count of read characters.





4. Basic data types include:


int, char,float and double.


void can also be referred to as one of the data types.


Derived data types include:


Arrays, pointers and functions





"Let Us C" is widely acclaimed as the best guide for learning C.


Thank you,


Regards.
Reply:The headers file are files that contain prototype of many built in function in c program.





printf- is a function that allows u to display any kind of text in ur program.





the format is printf("your text");





as a result u'll get what ever u write in between the commas(in this case "your text") will be displayed in screen as u run the program.





But c program can't perform this function without a prototype(it tells c program how to perform). These prototypes are written in header files. So if u want to use printf function u will need to include the header files in ur program.





scanf- this function is used for take a input from ur keyboard and store it against a variable (u will have to define the variable name and data type first in ur program)





the format is scanf("%d", %26amp;name);





where name is the name of the variable and %d is a string that depends on the type of variable u are using.





data types are types of variables u can use on c program u will find details here





http://www.cplusplus.com/doc/tutorial/va...





try the whole website for more info
Reply:I think you can easily do what the rest of us do, like google your questions. You are getting us to do the work for you, but there is a positive to it, that if we do not know the subject we get to learn it along with you.





http://snap.nlc.dcccd.edu/learn/nlc/prin...





http://www.devx.com/tips/Tip/14539





http://www.unet.univie.ac.at/aix/libs/ba...





http://groups.google.com.au/groups?q=hea...





http://groups.google.com.au/groups/searc...





I wonder though if it isn't yahoo staff who prepare these questions to get us involved, for it is common sense what one needs to do....but whatever...

calling cards

No comments:

Post a Comment