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

How do you make a calculator in code block by using c?

#include<stdio.h>

#include<conio.h>

int main(void)

{

float a,b,c=0, d=0, e=0,f=0;

printf("Please enter two numbers:\n");

scanf("%f %f", &a, &b);

c=a+b;

d=a-b;

e=a*b;

f=a/b;

printf("The sum of %f and %f is :%f\n", a,b,c);

printf("The subtraction of %f and %f is :%f\n", a,b,d);

printf("The multiplication of %f and %f is :%f\n", a,b,e);

printf("The division of %f by %f is :%f\n",a,b,f);

getch();

}

When did N. C. Vasanthakokilam die?

N. C. Vasanthakokilam died on 1951-11-07.

Why the header files have .h extension only?

Hi...

It's pretty simple. The .h stands for the word "header." It's merely a C convention that has been used throughout the years.

Conceivably, you could have "header" or "include" files with different extensions - the .h is the convention.

John

Why might you NOT want to implement paging in the DataGrid control as is?

You need to retrieve all of the data with each access to the page.

Dereferencing operator in c?

When we are talking about dereferencing in C we are talking about the pointers and how to get value from them, not address.

Dereferencing operator notation is "*".

Here is a simple example of dereferencing:

int num;

int pNum*;

pNum = # /* make pNum pointer point to numlocation in memory/stack */

*pNum = 7; /* setting pNum value to 7. Note! numvalue becomes 7 too, because pNum points to the same memory location as num */

Arrays whose size can be altered are known as?

Arrays whose size can be altered are known as dynamic arrays.

Using loop input 5 numbers and output its total sum?

Code Example:/* ******************************************************************************** * MODULE: main.c ******************************************************************************** * AUTHORS: * Flaun * * DESCRIPTION: * Prompts the user for 5 numbers and prints the sum of those numbers. ******************************************************************************** */ #include #define iNUMS_TO_SUM 5 int main(void) { int iInput = 0; int iSum = 0; int iCounter = 0; while(iCounter < iNUMS_TO_SUM) { printf("Enter a number: "); if(scanf("%d", &iInput) == 1) { iSum += iInput; } else { fprintf(stderr, "Error: Failed to read number from stdin.\n"); return 0; } iCounter++; } printf("Sum of numbers entered: %d.\n", iSum); return 0; }

Evaluate the expression 12?

Constant values are expressions as well, still I don't think they are so hard to evaluate... well, in this case it is twelve

How do you read binary file using c command?

FILE* f

f = fopen ("file name", "br");

... fread (f, ...);

fclose (f);

Find largest of n numbers using shell programming?

arg_cnt=$#

arg_list=$*

biggest=$1

if [ $arg_cnt -eq 0 ]; then

echo "$RF there should be minimum 1 argument"

exit 1

fi

for each_arg in $arg_list

do

if [ $each_arg -gt $biggest ]; then

biggest=$each_arg

fi

done

echo " Biggest number is : $biggest \n"

exit 0

C program for finding cube root of positive no?

#include "stdio.h"

#include "math.h"

int main()

{

double x;

printf("Enter the positive number.\n");

scanf("%lf", &x);

printf("Cube root of %lf is %lf.\n", x, pow(x, 1/3.0));

return 0;

}

What is CIN?

cin is the object of istream class i.e, input class.

What is the effect of dereferencing a null pointer variable?

You'd get a memory access violation. Nothing serious besides the fact that your program crashes (which is a good thing).

How do you print the elements of singly linked list-program?

#include<stdio.h>

#include<conio.h>

#include<alloc.h>

#define NULL 0

int item,ch;

struct slink

{

int data;

struct slink *next;

}

*start,*new,*l;

main()

{

clrscr();

start=NULL;

printf("\n**MENU**");

printf("\n1.CREATE \n2.PRINT \n3.EXIT ");

while(1)

{

printf("\nENTER YOUR CHOICE: ");

scanf("%d",&ch);

switch(ch)

{

case 1: create();

break;

case 2: print();

break;

default: exit();

break;

}

}

getch();

}

create()

{

start=NULL;

l=start;

printf("\nENTER THE DATA: \n");

scanf("%d",&item);

while(item!=0)

{

new=malloc(sizeof(struct slink));

new->data=item;

new->next=NULL;

if(start==NULL)

{

start=new;

l=new;

}

else

{

l->next=new;

l=l->next;

}

printf("\nENTER 0 TO TERMINATE: \n");

scanf("%d",&item);

}

}

print()

{

l=start;

while(l!=NULL)

{

printf("%d--> ",l->data);

l=l->next;

}

}

Why you divide a program into functions?

In order to make a large program more manageable, it is convenient to identify and isolate specific tasks that a program performs and to separate out those tasks into functions. These functions are used/invoked as needed by the main part of the program. They can also be invoked by other functions. Often a program will perform the same task in different parts of the program. Using a function to perform the task and invoking the function from the different parts of the program means that only one copy of the code is needed. This helps reduce the size of the program.

When was C Batter C created?

C Batter C was created on 2011-11-11.

What is physical node system?

A physical node system refers to a tangible, identifiable unit within a network or distributed computing environment that performs specific functions or tasks. Each physical node, such as a server or device, is equipped with its own hardware resources like CPU, memory, and storage, and can communicate with other nodes. This system enhances scalability, reliability, and performance by distributing workloads across multiple physical nodes, allowing for better resource management and fault tolerance.

What do you mean by multiple compilation?

Whenever you change the source, you have to re-compile it, to get a new object/executable.