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 are the 42 keywords in turbo c?

auto double int struct

break else long switch

case enum register typedef

char extern return union

const float short unsigned

continue for signed void

default goto sizeof volatile

do if static while

The arguments in an IF function are?

IF, in C and C++, is not a function - it is a statement. There are two parameters...

if (expression) statement;

The expression is evaluated. If it has logical result true, or arithmentic result not zero, the statement is executed; if not, the statement is not executed. The statement can be a single statement, in which it is terminated with a semi-colon, or it can be a block of statements, in which it is surrounded by braces.

Write an Algorithm for multiplication table of an integer?

int firstNumber,secondNumber

for(firstNumber = min; firstNumber <= max; firstNumber++);

{

for(secondNumber = min; secondNumber <=max; secondNumber++);

int result firstNumber * secondNumber;

}

Which of the following are helpful pointers for a successful briefing ssd1?

be on time
use only 1 main point per visual aid
use colors
make eye contact

Algorithm to convert postfix notation into infix notation?

/**************************//**********cReDo**********//*****mchinmay@live.com***///C PROGRAM TO CONVERT GIVEN VALID INFIX EXPRESSION INTO POSTFIX EXPRESSION USING STACKS.#include#include#include#define MAX 20char stack[MAX];int top=-1;char pop();void push(char item);int prcd(char symbol){switch(symbol){case '+':case '-':return 2;break;case '*':case '/':return 4;break;case '^':case '$':return 6;break;case '(':case ')':case '#':return 1;break;}}int isoperator(char symbol){switch(symbol){case '+':case '-':case '*':case '/':case '^':case '$':case '(':case ')':return 1;break;default:return 0;}}void convertip(char infix[],char postfix[]){int i,symbol,j=0;stack[++top]='#';for(i=0;i{symbol=infix[i];if(isoperator(symbol)==0){postfix[j]=symbol;j++;}else{if(symbol=='(')push(symbol);else if(symbol==')'){while(stack[top]!='('){postfix[j]=pop();j++;}pop();//pop out (.}else{if(prcd(symbol)>prcd(stack[top]))push(symbol);else{while(prcd(symbol)<=prcd(stack[top])){postfix[j]=pop();j++;}push(symbol);}//end of else.}//end of else.}//end of else.}//end of for.while(stack[top]!='#'){postfix[j]=pop();j++;}postfix[j]='\0';//null terminate string.}void main(){char infix[20],postfix[20];clrscr();printf("Enter the valid infix string:\n");gets(infix);convertip(infix,postfix);printf("The corresponding postfix string is:\n");puts(postfix);getch();}void push(char item){top++;stack[top]=item;}char pop(){char a;a=stack[top];top--;return a;}//mail me: mchinmay@live.com

What are constructors and deconstructors in C programming language?

Constructors are functions that you use to define (initialize) the properties and methods of a class. By definition, constructors are functions within a class definition that have the same name as the class. For example, the following code defines a Circle class and implements a constructor function: // file Circle.as class Circle { private var circumference:Number; // constructor function Circle(radius:Number){ this.circumference = 2 * Math.PI * radius; } } The term constructor is also used when you create (instantiate) an object based on a particular class. The following statements are calls to the constructor functions for the built-in Array class and the custom Circle class: var my_array:Array = new Array(); var my_circle:Circle = new Circle(9);

Application of linked list?

what are the main applications of double linked list?

1. Applications that have an MRU list (a linked list of file names)

2. The cache in your browser that allows you to hit the BACK button (a linked list of URLs)

3. Undo functionality in Photoshop or Word (a linked list of state)

4. A stack, hash table, and binary tree can be implemented using a doubly linked list.

5. A great way to represent a deck of cards in a game.

How do you write a program to arrange the elements in ascending order by using selection sort technique?

#include<iostream>

#include<vector>

template<class T>

void insertion_sort (std::vector<T>& v)

{

if (v.size()<2U)

return;

for (size_t index=1; index<v.size(); ++index)

{

T value = v[index];

size_t gap = index;

size_t prev = index-1;

while (gap && value<v[left] )

v[gap--]=v[left--];

v[gap] = value;

}

}

int main()

{

std::vector<int> vect {42, 1, 27, 8, 15, 4};

for (auto v : vect) std::cout << v << '\t';

std::cout << std::endl;

insertion_sort (vect);

for (auto v : vect) std::cout << v << '\t';

std::cout << std::endl;

}

How do you use C plus plus code in Java Program?

You don't. There are two possible workarounds.

  1. Use the Java Native Interface (JNI). JNI code resembles C-style code and is able to be compiled in the native machine language of the underlying system. This is a rather complicated solution, and is not ideal for a "quick fix."
  2. Write your C++ code like normal, compile it, and use Java code to call your compiled code. You can use the Runtime.getRuntime().exec() methods to accomplish this.

What is language translation in programming language?

This is usually the first stage in compilation. The source code is read and checked for syntax and usability then passed to the compile stage to be converted to object (or machine) code that the computer can understand.

Translator translates program written in one programming language into (equivalent) program written in another language. For example, Java to C# translator would translate Java program into (equivalent) C# program. This is similar to as if you would translate some text in English into Spanish or vice versa.

If target language is lower level language like assembly language, machine language, or pseudocode, translator is called compiler. For example, some C++ compiler could compile (translate) program in C++ into machine code.

10 example of a predefined function in a c?

1. Cat2. Cake3. Closet4. Coffin5. Cuckoon6. Cukoo Clock7. Clock8. Case9. Card10. ClothesThere we go, then things starting with C, if that is what you were asking for, but if its not, i would make your question more understandable, maybe change some words.Bye x

How pointer differs from normal variable?

Usual variable used so called value type mechanism, meaning that if you have passed the variable to a function the variable itself was not passed, only its copy. Which makes value type mechanism safe. The only problem is that you use a lot of memory because a copy of your variable has been created.
Pointers allow to avoid creating copies and operate with addresses of variables. It means when you pass your variable to any function, you actually pass only the variable's address. This mechanism is called reference type.
Pointers work much faster and allow to use memory more effectively. The only problem is you have to take extra care when you are working with pointers. Using pointers any area of memory including protected by OS can be accessed. Such event will cause "blue screen" (under windows).

What are the main functions of an Assembler?

An assembler is used to convert low-level assembly language into machine code. Assembly language is a symbolic language that maps 1:1 with the machine code produced by the assembler.

A compiler is used to convert a high-level language into a low-level language such as intermediate byte code, assembly or native machine code.

An interpreter is used to convert a high-level language or byte code into native machine code. Statements are typically converted to machine code instructions one statement at a time, rather than all at once.

All high-level are either compiled or interpreted, however some are both compiled and interpreted. Most compiled languages compile to machine code, however some, such as Java, compile to an intermediate byte code which must then be interpreted to produce the machine code.

How to calculate sum of two complex number in c plus plus?

typedef struct complex {

double real, imag;

} complex;

...

complex x, y, z;

...

/* add */

z.real = x.real + y.real;

z.imag = x.imag + y.imag;

/* sub */

z.real = x.real - y.real;

z.imag = x.imag - y.imag;

/* mul */

z.real = x.real*y.real - x.imag*y.imag;

z.imag =x.imag*y.real + x.real*y.imag;

/* div */

double d = y.real*y.real + y.imag*y.imag;

z.real = (x.real*y.real + x.imag*y.imag)/d;

z.imag = (x.imag*y.real - x.real*y.imag)/d;

C program to concatenate without using strcat?

#include
#include
#include
void main()
{
char str1[30],str2[30];
int l1,l2,i;
clrscr();
gets(str1);
gets(str2);
l1=strlen(str1);
l2=strlen(str2);

for(i=0;i<=l2;i++)
{
str1[l1+i]=str2[i];
}
printf("%s",str1);
getch();
}

What are the shortcut key for interpreter in turbo c?

Ctrl+s ---------- To save a program

F2 ---------- To save a program

F3 ---------- To open

F5 ---------- To view the page fully

Alt+f ---------- To open a file

Alt+F9 ---------- To compile a program

Ctrl+F9 ---------- To run a program

Alt+F5 ---------- To see the output

How do you find the time complexity of a given algorithm?

Time complexity gives an indication of the time an algorithm will complete its task. However, it is merely an indication; two algorithms with the same time complexity won't necessarily take the same amount of time to complete. For instance, comparing two primitive values is a constant-time operation. Swapping those values is also a constant-time operation, however a swap requires more individual operations than a comparison does, so a swap will take longer even though the time complexity is exactly the same.

What does loop the loop mean?

When your tying your shoe you loop the loop or some kind of dance.

To 'loop the loop' in an aeronautical term. It is a maneuver creating a vertical circle in the sky and was first 'invented' by the pilot Lincoln Beachey prior to 1915

What is the difference between extended binary tree and a binary search tree?

A strictly binary tree is one where every node other than the leaves has exactly 2 child nodes. Such trees are also known as 2-trees or full binary trees.

An extended binary tree is a tree that has been transformed into a full binary tree. This transformation is achieved by inserting special "external" nodes such that every "internal" node has exactly two children.

Which is not an example of an utility program?

Utilities are services that you need to maintain your home. The most common examples are water and electric power. It is hard to survive without them. Other utilities which may not be as necessary are gas, garbage, cable, and internet.

In C can functions be defined inside functions?

Standard C (C89 and C99 are the official standards) does not allow to define functions inside functions (known as nestedfunctions). However, some compilers, such as the free GCC allow nested functions as a language extension.

What is the stack algorithm to push an item?

Stack Data Structure
1.It is a Linear Data Structure.


2.In which a data item is inserted & deleted at one end.


3.It is a Last In - First Out (LIFO) Data Structure where the data item is inserted last into the stack is the first data item to be deleted from the stack.
NOTE:


Please refer to http://www.cosc.canterbury.ac.nz/mukundan/dsal/StackAppl.html site to understand the concept of stack using java applet.


Just Copy & Paste it in your browser,but you need a Java RunTime Environment(JRE) installed onto your PC.
4.Writting a value to stack is push operation.


5.Reading a value from the stack is pop operation.


6.Once an item is popped from the stack,it is no longer available.
Algorithm
1.push operation:
if top of the stack is greater than equal to maximum number of entries into the stack,
then print "Stack is already full.Cannot add more items."
top of stack = t
increment the top of the stack


2.pop operation:
decrement top of the stack
if top <0,then print "Stack is already empty.Noitems to read."


3.call these push & pop functions declared void in the main function using the switch statement.


4.The variable top & symbolic constant stack maximum items entry number has to be declared.


Create a program that will display the sum of all numbers from 1 up to the input number?

to print the sum of first ten numbers:-

void main()

{int i,sum;

sum=0;

while(i<=10)

sum=sum+i;

i=i+1;

}

printf("The sum is : %d",sum);

}