Author Archives: Naveed Tawargeri
Hi, I'm Naveed Tawargeri, and I'm the owner and creator of this blog. I'm a Software Developer with a passion for Programming.
Author Archives: Naveed Tawargeri
Hi, I'm Naveed Tawargeri, and I'm the owner and creator of this blog. I'm a Software Developer with a passion for Programming.
Here is the c program to find sum of two numbers Output Explanation: printf(“The sum is: %d\n”, c); prints the sum with a newline character for better output formatting. main Function: In C programming, the main function should always return an integer (int). This integer typically indicates the success or failure of the program (usually […]
Continue readingShow Command in C To display the contents of a file, we have the ‘type’ command in DOS and ‘cat’ to display command in unix. Program to demonstrate show command in C Save this program as ‘show.c’ and then compile and run it to get ‘show.exe’. To run this executable file, go to DOS prompt […]
Continue readingCommand Line Arguments in C Parameters and Arguments: Parameters are variables which are useful to receive data from outside into a function.The data or values passed to the function are called arguments. There are 4 ways of declaring the main() function – Command Line Arguments in C main() without any parameters We can write main() […]
Continue readingRandom accessing of file The data is stored in the form of several records in a binary files. Suppose we want to access te 4th record, then we should read from the first record till the third record. When the third record is read from the file, the file pointer reaches the end of the […]
Continue readingBinary Files in C Binary files are useful to store different types of data. For example, we have details of a bank customer like account number,name of the customer and balance amount in the account. These different types of data can be stored into a structure and then written into a binary file. The next […]
Continue readingFiles with strings To store a string into a file, we can use fputs() function. Similarly to read a string from a file we can use fgets() function. Both functions are defined in <stdio.h>. Program to store data in the form of strings into a text file. Output: In above program, we accept a string the keyboard as: We […]
Continue readingFiles with characters putc(): This function is useful to write a single character into a file. To store a character into a file shown by the file pointer ‘fp’, we can write: getc(): This function is useful to read a single character from a file. To read a character from the file represented by the […]
Continue readingFiles in C Organized collection of data is called a ‘file’. A file represents data which is arranged in a specific format and stored on a scecondary storage media like hard disk or CD. Opening a file in C We should use fopen() function to open a file. This function accepts ‘filename’ and ‘open mode’ in which […]
Continue readingUnion in C Unions are similar to structures in that they also store different types of elements. We can store different types of elements and store them in a union. Union is declared using the keyword ‘union’. Structure member operator (.) or structure pointer member (->) to refer structure elements. The same operator can be […]
Continue readingNested Structures Its possible to write one structure inside another structure. Such structures are called ‘nested structures‘. This can be achieved by declaring one structure variable inside another structure as an element. Suppose, we want to use this structure to store employee date of birth also, it can be represented as another structure To include […]
Continue reading