Category: C

void pointer in C

void pointer in C Till now, we have studied that the address assigned to a pointer should be of the same type as specified in the pointer declaration. For example, if we declare the int pointer, then this int pointer cannot point to the float variable or some other type of variable, i.e., it can […]

Dangling Pointers in C

Dangling Pointers in C: The most common bugs related to pointers and memory management is dangling/wild pointers. Sometimes the programmer fails to initialize the pointer with a valid address, then this type of initialized pointer is known as a dangling pointer in C. Dangling pointer occurs at the time of the object destruction when the […]

C String Functions

C String Functions There are many important string functions defined in “string.h” library.   No. Function Description 1) strlen(string_name) returns the length of string name. 2) strcpy(destination, source) copies the contents of source string to destination string. 3) strcat(first_string, second_string) concats or joins first string with second string. The result of the string is stored […]

Type Casting in C

Type Casting in C with examples Typecasting allows us to convert one data type into other. In C language, we use cast operator for typecasting which is denoted by (type). Syntax: (type)value; Without Type Casting: int f= 9/4; printf(“f : %d\n”, f );//Output: 2 With Type Casting: float f=(float) 9/4; printf(“f : %f\n”, f );//Output: 2.250000 Type Casting example Let’s see a simple example to cast int value into […]

C goto statement

C goto statement: The goto statement is known as jump statement in C. As the name suggests, goto is used to transfer the program control to a predefined label. The goto statment can be used to repeat some part of the code for a particular condition. It can also be used to break the multiple […]

C break statement

C break statement: The break is a keyword in C which is used to bring the program control out of the loop. The break statement is used inside loops or switch statement. The break statement breaks the loop one by one, i.e., in the case of nested loops, it breaks the inner loop first and […]

C Strings

C Strings The string can be defined as the one-dimensional array of characters terminated by a null (‘\0’). The character array or the string is used to manipulate text such as word or sentences. Each character in the array occupies one byte of memory, and the last character must always be 0. The termination character […]

C Identifiers

C Identifiers: C identifiers represent the name in the C program, for example, variables, functions, arrays, structures, unions, labels, etc. An identifier can be composed of letters such as uppercase, lowercase letters, underscore, digits, but the starting letter should be either an alphabet or an underscore. If the identifier is not used in the external […]

Tokens in C

Tokens in C Tokens in C is the most important element to be used in creating a program in C. We can define the token as the smallest individual element in C. For `example, we cannot create a sentence without using words; similarly, we cannot create a program in C without using tokens in C. […]