answersLogoWhite

0

📱

C Programming

Questions related to the C Computer Programming Language. This ranges all the way from K&R to the most recent ANSI incarnations. C has become one of the most popular languages today, and has been used to write all sorts of things for nearly all of the modern operating systems and applications. It it a good compromise between speed, power, and complexity.

9,649 Questions

What happens if recursion function is declared inline?

An inline function replaces the call to the function by the body of the function, thus reducing the overhead of saving the context in stack. This is good for functions which are small in size and called occasionally. A recursive function calls an instance of itself and thus can be a deeply nested. Different compilers handle this differently. Some will inline it up to a certain depth and then call a non-inlined instance for further recursion; others will not inline the function at all and generate a normal function call.

What looping process checks the test condition at the end of the loop?

The do..while() loop tests the condition at the end of the loop. Therefore the loop body executes at least once.

The while() loop (without do) tests the condition before entering the loop and before each iteration of the loop.

The for() loop conditional expression is optional but, when specified, is tested before entering the loop and before each iteration of the loop.

How do you create a folder in c lang and take the name from user and how to create a folder inside user's folder?

In ANSI/ISO standard there is no any function that would be capable of doing that. You should need to look for special system function in order to create folder. Systems with support for the POSIX libraries can use the mkdir() function. For example, if you are using UNIX type operating system, you could include "sys/dir.h" and use mkdir().

Example:

#include

#include

#include

int main() {

int code = mkdir("folder");

if (code 0) {

printf("SUCCESS\n");

} else {

printf("FAILURE\n");

}

return 0;

}

In this example we are calling other command line utility in background - mkdir and telling it to create folder named "folder".

How do you get free borland c plus plus software?

There are many vendors of C++ compilers. Your choice depends on what platform you use, and whether or not you want paid support. Two compilers (remember, there are many) are GCC, at gcc.gnu.org, and Visual Studio, at www.microsoft.com/vstudio. Be sure to review the requirements, cost, and license details before you choose.

Why multidimensional array element access using indirection operator?

The number of dimensions is immaterial. All arrays are implemented as a one dimensional array. A multidimensional array is simply an array where every element is itself an array.

The only thing actually known about any array is that its name is a reference to the start address. Unlike an ordinary (non-array) variable, the elements in the array do not have names, we can only refer to them by their memory offsets from the start of the array. As such, in order to obtain the values stored at those offsets, we must dereference them. While the subscript operator gives us notational convenience, it's easy to forget that there's actually pointer arithmetic and dereferencing going on behind the scenes.

Why array is a implicit pointer?

An array of pointers is exactly what it sounds like - one or more pointers arranged in order in memory, accessible through a common base name and indexed as needed. Philosophically, there is no difference between an array of pointers and an array of objects...

int a[10]; // 10 integers, named a[0], a[1], a[2], ..., a[9]

int *b[10]; // 10 pointers to int, named b[0], b[1], b[2], ..., b[9]

If you initialize the array of pointers...

int i;

for (i = 0; i < 10; i++) b[i] = &a[i];

... then *b[0] would be the same as a[0], etc.

What is a binary operator in the C language?

In programming languages, a binary operator is an operator which takes two operands. For example, the divide-by sign between divident and divisor is a binary operator:

x = a / b

Other binary operators include + - * & | ^, among others.

Note that the operator is binary, not the character representing it. Take, for example, the minus sign. The minus sign represents the binary subtraction operator when used between two arithmetic expressions (e.g. x = a - b). However, when used left of an arithmetic expression, it indicates a negative sign (e.g. x = -a). Parentheses may be required to avoid ambiguity or enhance readibility of both effects are combined (e.g. x = a - (-b)).

What are the two methods of representing a binary tree?

Two method of representing a binary tree is

Static allocation, and

Dynamic allocation

What is grace Murray hopper known for?

She was one of the first programmers of one of the first computers. See the related link for more information.

What is the difference between looping statements - c program?

Repetition.

For example the following lines do the same thing:

while (expression) statement;

LABEL: if (expression) {statement; goto LABEL; }

Or these: for (exp1; exp2; exp3) statement;

exp1; LABEL: if (exp2) {statement; exp3; goto LABEL; }

What is the array for 7x8?

int a[8][5]= {{a1,b1,c1,d1,e1},

{a2,b2,c2,d2,e2},

{a3,b3,c3,d3,e3},

{a4,b4,c4,d4,d4},

{a5,b5,c5,d5,e5},

{a6,b6,c6,d6,e6},

{a7,b7,c7,d7,e7},

{a8,b8,c8,d8,e8}};

This is an Integer Array Containing 40 elements or 40 integer values.

In this e.g. First (dimension) subscript-8 will be the row and the second (dimension) subscript -5 will be the column.

What are callback functions?

In computer science, a callback is executable code that is passed as an argument to other code. It allows a low level software layer to call a function occurring in a higher level layer. Usually the higher level code first calls a function within the lower level code passing to it a pointer or handle to another function. Then the lower level function in the course of executing may call the passed-in function any number of times to perform some subtask. Another option is that the lower level function registers the passed-in function as a handler that is to be called asynchronously by the lower level at a later time in reaction to something. A callback can be used as a simpler alternative to polymorphism and generic programming, in that the exact behavior of a function can be dynamically determined by passing different (yet compatible) function pointers or handles to the lower level function. This can be a very powerful technique for code reuse.

Why c is top down approach?

It doesn't. Programmers might use any approach they like.

What are the advantage of function prototype?

It allows the compiler to verify that the number and types of the functions parameters are correct when the function is actually called.

If the function were called with the wrong number or type of parameters, and no function prototype were supplied, the error would not be discovered until the program was actually run.

How does one make a C GUI application?

A Graphical User Interface (GUI) is, first and foremost, an event-driven program that runs on top of a command-line-driven operating system. Designing a GUI completely from scratch is not something to be undertaken lightly.

The easiest way to create a GUI is to use a framework. Visual C++ provides the Microsoft Foundation Classes (MFC) framework which allows you to build Windows applications that conform to the Windows GUI, whilst giving you the freedom to design your own elements that can interact with the GUI, even if they bear no resemblance to the standard GUI elements. However, you cannot alter the Windows GUI itself (globally, that is) as it is an intrinsic component of the operating system. Although you can manipulate GUI elements in real-time, this places a huge strain upon resources and will greatly impede the overall performance.

Under Linux you have far greater freedom because the command-line-driven kernel is completely separate from the GUI, thus you are free to design your own. This allows you to completely alter the GUI in any way you see fit. Again, a GUI framework is the easiest way to begin as it provides all the basic elements of a GUI, including message queues, memory management and multi-tasking -- all you really have to do is design the visual aspects of each element.

What is the difference between macros and constant variable?

Macros are processed at preprocessing time where as constant variables are processed at complie time. Macros doesnot have any scope but constant variables has scope. Macros doesnot have the type checking where as constant variables have type checking.

Add two numbers in pointer in using c program?

//Adding two numbers using pointers

#include<stdio.h>

void main()

{

int *a,*b,c,n1,n2;

scanf("%d %d",&n1,&n2);

a=&n1;

b=&n2;

c=*a+*b;

printf("Added value is:%d",c);

}