Posts

Showing posts from September 6, 2020

What is a pointer ? Write a C program using pointer to print the name and price of the items sold in a retail shop on a specific date.

What is a Pointer? Write a C program using a pointer to print the name and price of the items sold in a retail shop on a specific date.  Pointers in C are easy and fun to learn. Some C programming tasks are performed more easily with pointers, and other tasks, such as dynamic memory allocation, cannot be performed without using pointers. So it becomes necessary to learn pointers to become a perfect C programmer. Let's start learning them in simple and easy steps. #include <stdio.h> int main () { int var1 ; char var2 [ 10 ]; printf ( "Address of var1 variable: %x\n" , & var1 ); printf ( "Address of var2 variable: %x\n" , & var2 ); return 0 ; } What are Pointers? A  pointer  is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before using it to store any variable address. The general form of a pointer v...

What is a file in C programming ? Explain the use of fopen function in file handling. Explain different mode in which a file can be opened.

 What is a file in C programming? Explain the use of fopen function in file handling. Explain different modes in which a file can be opened. File Input and Output Overview A computer file is a computer resource for recording data discretely in a computer storage device. Just as words can be written to paper, so can information be written to a computer file. There are different types of computer files, designed for different purposes. A file may be designed to store a picture, a written message, a video, a computer program, or a wide variety of other kinds of data. Some types of files can store several types of information at once. By using computer programs, a person can open, read, change, and close a computer file. Computer files may be reopened, modified, and copied an arbitrary number of times. Discussion In computer programming, standard  streams  are pre-connected input and output communication channels between a computer program and its environment when it begins e...