C Interviews
C Interview
The array subscripts always start at zero. The compiler makes use of subscript values to identify the elements in the array. Since subscripts start at 0, it is said that array uses zero-based addressing.
In C, the functions can be divided into the following categories : ? Functions with no arguments and no return values ? Functions having arguments but no return values ? Functions having arguments and return values also
A loop is a process to do a job repeatedly with possibly different data each time. The statements executed each time constitute the loop body, and each pass is called iteration. A condition must be present to terminate the loop.
There are five basic Data types in C. These are : ? void : means nothing i.e. no data involvement in an action ? char : to work with all types of characters used in computer operations ? int : to work with an integer type of data in any computational work ? float : to work with the real type of data or scientific numbers in the exponential form ? double : to work with double precision of numbers when the approximation is very crucial.
When a break is encountered inside a loop, the loop is terminated and the control passes to the statement following the body of the loop.
It returns a character just entered from the standard input unit, that is, keyboard. The entered character can be either assigned to a character variable or echoed to the computer screen
Fread(), buffer is a pointer to an area of memory that will receive the data from the file. For fwrite(), buffer is a pointer to the information that will be written to the file. The value of count determines how many items are read or written, with each item being num_byte bytes in length. The size_t in both the formats is defined as some kind of unsigned integer. Finally, fp is a file pointer to a previously opened file.
I/O functions are grouped into two categories : ? Unformatted I/O functions ? Formatted I/O functions
The formatted I/O functions allow programmers to specify the type of data and the way in which it should be read in or written out. On the other hand, unformatted I/O functions do not specify the type of data and the way is should be read or written.
The putchar function displays one character on the display monitor. The character to be displayed is of type char. The syntax for putchar function is as given below :putchar (ch_var); Where ch_var is a previously declared character variable.