Posts

IGNOU PROGRAMEE GUIDE FOR MASTER OF COMPUTER APPLICATION (MCA)

 MASTER OF COMPUTER APPLICATION (MCA)               I SEMESTER COURSE CODE COURSE TITLE CREDITS MCS-011 Problem   Solving and Programming 3 MCS-012 Computer Organization and Assembly Language Programming 4 MCS-013 Discrete Mathematics 2 MCS-014 System Analysis and Design 3 MCS-015 Communication Skills 2 MCSL-016 Internet Concepts and Web Design 2   MCSL-017 C and Assembly Language Programming Lab 2  

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...

What is a macro ? Explain how a macro is defined in C. Also explain major differences between a macro and a function. Explain a situation when macro should be prefered over function with an example.

 What is a macro? Explain how a macro is defined in C. Also explain major differences between a macro and a function. Explain a situation when macro should be preferred over function with an example? IN C language , A  macro  is a fragment of code that has been given a name. Whenever the name is used, it is replaced by the contents of the  macro . There are two kinds of  macros . You may define any valid identifier as a  macro , even if it is a  C  keyword. The preprocessor does not know anything about keywords.  macro  is preprocessed. When you use a  MACRO , the C preprocessor will translate all strings using  macro  and then compile. See the following example of Macro: #include<stdio.h> #define NUMBER 10 int main() {       printf ( "%d" , NUMBER);       return 0; Output: 10 Difference between macro and functions  MACRO FUNCTION Macro is Preprocessed Function...

What is a string ? Write a function in C for string concatenation. Without the use of inbuilt string function?

Image
 What is a String? Write a function in C for string concatenation. Without the use of an inbuilt string function. String A string is a data type used in programmings, such as an integer and floating-point unit, but is used to represent text rather than numbers. It is comprised of a set of characters  that can also contain spaces and numbers. For example, the word "hamburger" and the phrase "I ate 3 hamburgers" are both strings. Even "12345" could be considered a string, if specified correctly. Typically, programmers must enclose strings in quotation marks for the data to recognized as a string and not a number or variable name . String concatenation in C C program to concatenate two strings, for example, if the two input strings are "C programming," and " language" (note the space  before language), then the output will be "C programming language." To concatenate the strings, we use strcat function of string.h, to concatenate ...