Found 1401 Articles for C

Limitations of C programming language

Bhanu Priya
Updated on 09-Mar-2021 06:30:36

3K+ Views

ProblemWhat are the limitations of C Programming when compared to other programming languages?SolutionC Language prevents or prohibits the concepts of object-oriented programming language like inheritance, polymorphism, encapsulation, and data abstraction.C programming language does not detect errors for every line of coding, it will check the bugs after the complete coding is done.It does not exhibit namespace property.C programming has an insufficient level for data abstraction, i.e., does not have very large data handling capacity.C Language does not allow the user to detect the errors with the help of exception handling features.The constructor and destructors concept is not supported by the ... Read More

How to delete the vowels from a given string using C language?

Bhanu Priya
Updated on 08-Mar-2021 10:31:28

4K+ Views

The logic we use to implement to delete the vowels from the given string is as follows −for(i=0; i

How to use Pre-defined mathematical function in C language?

Bhanu Priya
Updated on 08-Mar-2021 10:29:13

238 Views

ProblemHow to find the cube root of any given number by using the C programming language?SolutionAlgorithmStep 1: Enter any number at run time Step 2: Read from console Step 3: Compute result         Result:pow(number, 1.0/3.0) Step 4: Increment result Step 5: Print resultExampleFollowing is the C program to find the cube root of any given number −//finding cube root of given number// #include #include #include void main(){    int number, result;    printf("Enter any number: ");    scanf("%d", &number);    result=pow(number, 1.0/3.0);    result++;    printf("\Cube of %d is: %d", number, result);    getch(); }OutputWhen the above ... Read More

What are the input and output for strings in C language?

Bhanu Priya
Updated on 08-Mar-2021 10:27:24

4K+ Views

An array of characters (or) collection of characters is called a string.Input and output for stringsExampleFollowing is the C program for input and output for strings −#include main ( ){    char a[30];    printf("enter your name");    scanf ( "%s", a);    printf ("your name is %s", a);    getch ( ); }OutputWhen the above program is executed, it produces the following result −1. Enter your name : Lucky 2. Enter your name : Lucky Lol Your name is Lucky Your name is LuckyNote −‘&’ is not used for accepting strings because name of the string itself specifies the ... Read More

What is a string? Declare and initialize the strings in C language

Bhanu Priya
Updated on 08-Mar-2021 10:26:10

6K+ Views

An array of characters (or) collection of characters is called a string.DeclarationRefer to the declaration given below −char stringname [size];For example - char a[50]; a string of length 50 characters.InitializationThe initialization is as follows −Using single character constant −char string[20] = { ‘H’, ‘i’, ‘l’, ‘l’, ‘s’ ,‘\0’}Using string constants −char string[20] = "Hello":;‘\0’ is called a null character. It marks the end of the string.‘\0’ is automatically placed by the compiler, if a string is given as input. The user has to take care of placing ‘\0’ at the end if a single character is given.Accessing − There is ... Read More

What is call by value in C language?

Bhanu Priya
Updated on 08-Mar-2021 10:12:37

502 Views

Pass by value or call by value are sent as arguments.AlgorithmRefer to the algorithm for the call by value.Step 1: Enter any 2 numbers at runtime Step 2: Read those two numbers from console Step 3: Call the function swap with arguments is a call by value Step 4: Go to called function         swap(int a, int b) Step 5: Print the numbers after swapExampleFollowing is the C program for the call by value −#include void main(){    void swap(int, int);    int a, b;    clrscr();    printf("enter 2 numbers");    scanf("%d%d", &a, &b);    printf("Before ... Read More

What is call by reference in C language?

Bhanu Priya
Updated on 08-Mar-2021 10:10:58

525 Views

Pass by reference means addresses are sent as arguments.The call by reference or pass by reference method passes the arguments to a function by the means of address to an argument. This is done into the formal parameter. Inside the function, the address is used to access an actual argument.Example#include void main(){    void swap(int *, int *);    int a, b;    printf("enter 2 numbers");    scanf("%d%d", &a, &b);    printf("Before swapping a=%d b=%d", a, b);    swap(&a, &b); //address are sent as an argument    printf("after swapping a=%d, b=%d", a, b);    getch(); } void swap(int *a, int ... Read More

Explain the END OF FILE (EOF) with a C Program

Bhanu Priya
Updated on 14-Sep-2023 21:13:13

27K+ Views

The End of the File (EOF) indicates the end of input.After we enter the text, if we press CTRL+Z, the text terminates i.e. it indicates the file reached end nothing to read.AlgorithmRefer to the algorithm given below for EOF.Step 1: Open file in write mode. Step 2: Until character reaches end of the file, write each character in filepointer. Step 3: Close file. Step 4: Again open file in read mode. Step 5: Reading the character from file until fp equals to EOF. Step 5: Print character on console. Step 6: Close file.ExampleFollowing is the C program for End of ... Read More

How to access an array element in C language?

Bhanu Priya
Updated on 08-Mar-2021 10:02:11

5K+ Views

An array is a group of related data items that share a common name. A particular value in an array is identified by using its "index number" or "subscript".The advantage of an array is as follows −The ability to use a single name to represent a collection of items and to refer to an item by specifying the item number enables the user to develop concise and efficient programs.The syntax for declaring array is as follows −datatype array_name [size];For example, float height [50]This declares ‘height’ to be an array containing 50 float elements.int group[10]This declares the ‘group’ as an array ... Read More

What do you mean by buffer in C language?

Bhanu Priya
Updated on 08-Mar-2021 09:50:04

9K+ Views

A temporary storage area is called buffer. All input output (I/O) devices contain I/O buffer.When we try to pass more than the required number of values as input then, the remaining values will automatically hold in the input buffer. This buffer data automatically go to the next input functionality, if it is exists.We have to clear the buffer before the next input is taken in.ExampleFollowing is the C program for buffer −#include void main(){    int a, b;    printf(" Enter a value: ");    scanf("%d", &a);    printf(" Enter b value: ");    scanf("%d", &b);    printf(" a+b=%d ", ... Read More

Advertisements