Bhanu Priya

Bhanu Priya

1,061 Articles Published

Articles by Bhanu Priya

Page 48 of 107

Explain scope rules related to the functions in C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 920 Views

Scope rules in C programming determine the accessibility, lifetime, and boundary of variables within different parts of a program. Understanding scope is crucial for proper variable management and avoiding naming conflicts. Syntax // Local variable declaration return_type function_name() { data_type local_variable; // Local scope } // Global variable declaration data_type global_variable; // Global scope return_type function_name() { // Function body } Function Scope Rules Scope rules related to functions follow these principles − Local Variables: Variables declared within a ...

Read More

What are the predefined functions in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 11K+ Views

In C programming, functions are classified into two main types − Predefined functions (Library functions) User-defined functions Predefined functions are pre-written functions available in C standard libraries. They provide ready-to-use functionality for common programming tasks, helping developers write efficient and error-free code. Syntax #include return_type function_name(parameters); Key Features of Predefined Functions Already defined in system libraries Tested and optimized for performance Reduce development time and effort Require appropriate header file inclusion Follow standard syntax and conventions Common Mathematical Functions The math.h library provides various mathematical ...

Read More

What are different pointer operations and problems with pointers in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 3K+ Views

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. Syntax datatype *pointer_name; Where datatype is the type of variable the pointer will point to, and pointer_name is the name of the pointer variable. Memory Representation Consider the following statement − int qty = 179; 179 qty Address: 1000 ...

Read More

How to print the range of numbers using C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 2K+ Views

In C programming, finding the range of a given number means determining the interval of 10 consecutive numbers within which that number falls. For example, if the number is 45, it falls in the range 40-50. Syntax lower = (n/10) * 10; upper = lower + 10; How It Works The logic to find the range uses integer division to extract the tens digit − Lower bound: (n/10) * 10 removes the units digit and gives the nearest lower multiple of 10 Upper bound: lower + 10 gives the next multiple of ...

Read More

Explain the Format of C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 2K+ Views

C programming is a general-purpose, procedural, imperative computer programming language developed by Dennis Ritchie at Bell Labs in the early 1970s. The C language follows a specific format and syntax rules that must be adhered to for successful compilation and execution. Key Formatting Rules in C The C programming language follows these essential formatting conventions − Statements are terminated with semicolons (;) C is case sensitive Indentation is ignored by the compiler but improves readability Strings are placed in double quotes ("") Library functions and keywords are lowercase Newlines are handled via escape sequence ...

Read More

Check if the value entered is palindrome or not using C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 698 Views

A palindrome is a number, word, or sequence of characters that reads the same backward as forward. For example, 121, 1331, and 12321 are palindromic numbers. To check if a number is a palindrome in C, we reverse the number and compare it with the original. If both are equal, the number is a palindrome. Syntax while (n > 0) { remainder = n % 10; reversed = (reversed * 10) + remainder; n = n / 10; } Algorithm The ...

Read More

Explain the Random accessing files in C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 12K+ Views

Random access in C allows you to move the file pointer to any position within a file, enabling non-sequential reading and writing operations. This is accomplished using three key functions that control file pointer positioning. Syntax long ftell(FILE *stream); void rewind(FILE *stream); int fseek(FILE *stream, long offset, int whence); ftell() Function The ftell() function returns the current position of the file pointer as a long integer representing the byte offset from the beginning of the file. #include int main() { FILE *fp; ...

Read More

What are the high level I/O functions in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 5K+ Views

High-level I/O functions in C provide an abstracted, user-friendly interface for input and output operations. These functions are part of the standard C library and offer better portability compared to low-level I/O functions. High Level vs Low Level I/O High Level I/O Easy to understand and use by programmers Portable across different systems Built-in buffering for better performance Low Level I/O Closer to the operating system Faster execution time System-dependent (non-portable) High Level I/O Functions The high level input-output (I/O) functions are explained below − Function Description ...

Read More

Give the clarity on Pointer structures with suitable example in C language

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 232 Views

Pointer to structure holds the address of an entire structure. Mainly, these are used to create complex data structures such as linked lists, trees, graphs and so on. The members of the structure can be accessed by using a special operator called arrow operator ( -> ). Syntax struct tagname *ptr; For example: struct student *s; Accessing Structure Members You can access pointer to structure members using the arrow operator − ptr->membername; For example: s->sno, s->sname, s->marks Example The following C program demonstrates ...

Read More

How to pass the address of structure as an argument to function in C language?

Bhanu Priya
Bhanu Priya
Updated on 15-Mar-2026 673 Views

Passing the address of a structure as an argument to a function allows the function to access and modify the original structure through a pointer. This technique is memory-efficient and enables direct manipulation of structure members. Syntax return_type function_name(struct structure_name *pointer_variable); Key Points The address of the structure is passed as an argument to the function. It is collected in a pointer to structure in function header. Advantages No wastage of memory as there is no need of creating a copy again No need of returning the values back ...

Read More
Showing 471–480 of 1,061 articles
« Prev 1 46 47 48 49 50 107 Next »
Advertisements