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 washers function using Dialogic?

The machine only needs to be loaded, and told what is the most delicate garment in the wash. It then evaluates other wash factors to create the "perfect" wash--lowest possible noise, cleanest rinse, appropriate detergent, and appropriate water usage

Write a c program that reads ten integers and prints the first and the last numbers on one line and second and ninth on one line and so on....?

#include <cstdio>

int main()

{

int x[10];

printf("Enter 10 integers: \n");

for(int i = 0; i < 10; i++)

{

scanf("%d", &x[i]);

}

for(int i = 0; i < 10; i++)

{

printf("%d, ", x[i]);

}

char wait;

scanf("%s", wait);

return 0;

}

How do you draw Logic Gates in C language?

The C language is not a graphics language and you cannot draw logic gates using it. C is a programming language, and it is possible to use a graphics library to do so, but you did not specify which library you were using. Please restate the question.

How to find the mirror image of a binary tree?

Refer to http://cslibrary.stanford.edu/110/BinaryTrees.html

void mirror(struct node* node) {

if (node==NULL) {

return;

}

else {

struct node* temp; // do the subtrees

mirror(node->left);

mirror(node->right); // swap the pointers in this node

temp = node->left;

node->left = node->right;

node->right = temp;

}

}

What is error 601?

On a RadioShack TRS 80, It is a Syntax Error

"Syntax Error 601"

Counting even and odd numbers algorithm?

#include

using std::cout;
using std::endl;

int main()
{
int arr[] = {2, 45, 34, 56, 56};//you define here your array of even and odd numbers
int arrSize = sizeof arr/sizeof arr[0];

int numEven = 0;
int numOdd = 0;
for (int i = 0; i < (arrSize - 1); i++)
{
if (arr[i] % 2 == 0)
{
numEven++;

}
else
{
numOdd++;

}

}

cout << endl << "Number of even numbers: " << numEven
<< endl << "Number of odd numbers: " << numOdd
<< endl;

system("PAUSE");
return 0;

}

Why compiler doesn't support space in between character array?

int main (void)

{

char msg [] = "You are wrong here, spaces are perfectly okay";

puts (msg);

return 0;

}

How do you assign or print special symbols in c plus plus?

UTF-16 strings or characters (std::wstring or wchar_t) are the best method of assigning and printing special symbols. UTF-8 encoding using std::string can be used to minimise memory consumption but still requires conversion to wide-string for printing purposes. However, if the symbols are within the range of extended ASCII character codes (0x00 to 0xff), then an unsigned char or std::string is all you really need.

How do you store a string of letters for example abcdeabcde each to an array?

In C programming you would use the following:

char a[] = "abcdeabcde";

If you wish to create an array with more than one string, use an array of character pointers instead:

char* a[] = {"abcde", "fgh", "ijklm", "nopq", "rstu", "vwxyz"};

Write a program in C to accept 10 integers and print them in reverse order using linked list?

# include<stdio.h>

# include<conio.h>

void main()

{

int arr[10];

int i,j,temp;

clrscr();

for(i=0;i<10;i++)

scanf("%d",&arr[i]);

for(i=0;i<9;i++)

{

for(j=i+1;j<10;j++)

{

if(arr[i]<arr[j])

{

temp=arr[i];

arr[i]=arr[j];

arr[j]=temp;

}

}

}

printf("\nSorted array elements :\n");

for(i=0;i<10;i++)

printf("%d ",arr[i]) ;

getch();

}

What has the author C C Eldridge written?

C. C. Eldridge has written:

'British Imperialism in the 19th Century (Problems in Focus)'

Write a program that read and display double number?

class simple

{

public static void main(String[] args){System.out.println(new java.util.Scanner(System.in).nextDouble());}

}

What are primary data structure?

A primary data structure is a data structure that is created without the use of other data structures, whereas a secondary data structure relies on a primary data structure. A data structure is an organized collection of data elements.

[NOTE: Be careful not to confuse the term data structure with the term data type. It is a common mistake. This answer addresses dat structures. Often people who ask about primary data structures or primitive data structures are really asking about primitve data types.]

Here is an example where an array is a primary data structure and a binary tree is a secondary data structure based on the array:

An array is a primary data structure -- it is a set of sequentially numbered data elements, such as an array of integers or an array of names -- name0, name, name2, ...

A binary tree is a data structure where each element (called a node) has a data component and pointers to it's left and right sub-trees. [Think of a directory of folders, but each folder can only have two sub-folders.] We can create an and store an array of nodes to set up the tree in languages like C++ or Java.

The root of the tree could be node 1 in the array, it would point to nodes 2 and 3. node 2 would point to nodes 4 and 5, while node 3 would point to nodes 6 and 7 .. and so on. generally node n point to nodes 2n and 2n+1. (You can start with node 0, but the math is a little easier if you start with node 1.)

The binary tree in this case is the secondary data structure, while the undelying array is the primary data structure.

What is main difference between macro and subroutins?

marco expand where it invoked ,subroutine will go where the subroutine is defined....

What type of interface does Linux use?

You need to be more clear in what type of "interface" you are inquiring about. Linux has it's own API (Application Programming Interface) and ABI (Application Binary Interface). If you are referring to the user interface, Linux can have a GUI, a command line, or even no interface at all.

When did J B Coats write Where Could I go but to the Lord?

The song, "Where Could I Go but to the Lord", was written in 1940 by James (J. B.) Coats, a songwriter from the Gitano Community (Jones County), Mississippi. The inspiration for the song came some years earlier when Mr. Coats was at the bedside of one of his dying neighbors, an African-American gentleman named Joe Keyes.

Being a preacher, Mr. Coats had asked Mr. Keyes if he knew where he would spend eternity when he did. Mr. Keyes simply replied, "Where could I go but to the Lord?" Some years later, as he was away from home teaching a singing school, Mr. Coats finally included these words in a gospel song. Mr. Coats died in 1961.

Does c plus plus need a function named main?

If this is a homework assignment, you really should try to answer it on your own first, otherwise the value of the reinforcement of the lesson due to actually doing the assignment will be lost on you.

Every C or C++ program (but see below) needs one and only function named main. The standard prototype is int main (int argc, char *argv[]); The run-time library looks for main as its first function to call after startup initialization.

In a Microsoft Windows application, the entry point is winmain. Operation is similar, though parameters are different.

Can you give an example of a basic 'Hello World' program?

#include<iostream>

int main()

{

std::cout << "Hello world!" << std::endl;

return(0);

}

What is the c code for multistage graph?

#include<stdio.h>

#include<conio.h>

int G[50][50],n,i,j,h,k;

void FGraph();

int findR();

void main()

{

clrscr();

printf("\t\t\tmultistage graph");

printf("\n enter the no of vertices:");

scanf("%d",&n);

printf("\n there is a edge between the follwing vertices enter its weight else 0:\n");

for (i=1;i<=n;i++)

for(j=1;j<=n;j++)

{

G[I][J]=0;

IF(I!=J)&&(i<J))

{

printf ("%d and%d:",i,j);

scanf(%d,&G[i][j]);

}

}

FGraph();

getch();

}

void FGraph()

{

int cost[50],d[50],p[50],r;

for(i=1;i<=n;i++)

cost[i]=0;

for(j=n-1;j>=1;j++)

{

r=findR(j+1);

cost[j]=G[j][r]+cost[r];

d[j]=r;

}

p[1]=1;p[k]=n;

for(j=2;j<k;j++)

p[i]=d[p[j-1]];

printf("%d-",d[1]);

for(j=2;j<n;j++)

{

if((d[j]==d[j-1])(d[j]==0))

continue;

if(d[j]<=n)

printf("%d-"d[j]);

}

printf("%d",n);

}

int findR(int cu)

{

int r1=n+1;

for(h=1;h<=n;h++)

{if((G[h][cu]!=0)&&(r1==n+1)){

r1=j;

continue;

}

if(G[h][cu]!=0)

{

if(G[h][cu]<G[r1][cu])

r1=h;

}}

return r1;

}sorry i have answerd in c++