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

Who are stack holders?

Different parties have a stake in the quality of the outcome and the impact of changesrelated to an Organization.

Define structure oriented programming language?

A structure oriented language is one, which should the following structure as Documentation Section, Link section, Definition Section, Global declaration section and Functions(including Main functions) in an hierarchical order. This order cannot be interchanged, but structure oriented language like C can have these sections as optional. Correct me if am wrong, Neela.T

How do you write c program to find sum of two numbers?

For example:

c = a + b;

(This calculates the sum of a + b, and assigns the result to variable c.)

If you repeatedly want to add something to an accumulated sum:

b = b + a;

or better:

b += a;

For example:

c = a + b;

(This calculates the sum of a + b, and assigns the result to variable c.)

If you repeatedly want to add something to an accumulated sum:

b = b + a;

or better:

b += a;

For example:

c = a + b;

(This calculates the sum of a + b, and assigns the result to variable c.)

If you repeatedly want to add something to an accumulated sum:

b = b + a;

or better:

b += a;

For example:

c = a + b;

(This calculates the sum of a + b, and assigns the result to variable c.)

If you repeatedly want to add something to an accumulated sum:

b = b + a;

or better:

b += a;

How can loops be used to process arrays?

Loops can be used to iterate or walk through an array. For example, suppose you have an array already initialized (we'll call it "array"):

int target = -1;

for (i=0; i < array.length(); i++){

if (array[i] = target){

//do something

}

}

Here, we will walk through an array (note that arrays are zero indexed) using a loop to make sure we hit each element of the array. In our loop, we start at the head (or first element) and iterate over each element.

What is strongly typed programming language?

Yes, Python is strongly-typed.

You can test if any language is strongly-typed with a very simple example:

x = 1

y = "2"

z = x + y

The above will not compile in a strongly typed language because y is a string, not a number. That is, the language will not implicitly convert y to a number simply because you used it in a numeric expression. A weakly-linked language will perform the conversion behind the scenes.

Note that some strongly typed languages will permit the following:

value = 1

value = "one"

This is an example of dynamic typing; the same variable has explicitly changed type. This is not possible with statically typed languages. However, dynamic typing does not imply weak typing. Dynamic typing is explicit, weak typing is not.

C code programming to reverse a number?

/*The coding style used in this source code is for convenience.

* It is widely used style of coding. */

#include <stdio.h>

void main() {

int number, modulus, reverse;

reverse = 0;

printf("Enter a number \n");

scanf("%d", &number);

while(number != 0) {

modulus = number % 10;

reverse = (reverse * 10) + modulus;

number =number / 10;

}

printf("The reversed number is %d", reverse);

getch();

}

C program without main functoin?

If we save our program with .c extention before compiling it, the compiler with automatically include the header files. for eg-

First we save our program with sum.c and then compile it. It will not show any error.

1. Compilation needs header files, not execution.

2. Very small example programs can be written without using any header file, eg:

/* mini.c */

extern void (const char *puts);

int main (void)

{

puts ("Hello, world");

return 0;

}

What are the rules for naming an array?

The same rules apply to naming arrays as for naming any other identifier (be it a user-defined data type, variables or constants and function names). All identifiers must begin with a non-digit character (see below) and must be unambiguous. Global or external identifiers may be subject to additional restrictions as they have to be processed by other software such as linkers.

Non-digit characters:

_ a b c d e f g h i j k l m n o p q r s t u v w x y z

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

How can you add different type of data in a stack?

stack is a linear data structure in which data item is either inserted or deleted at one end there are mainly two operations performed on stack.they're push poppush:writing a value to the stack is push or moving the stack pointer up to accomodatethe new item. pop:reading a value from stack or moving the stack pointer down.

Factorial of a number using recursion?

#include<stdio.h>

main()

{

int a;

printf("Enter a");

scanf("%d",&a);

a=fun(a);

printf("%d",a);

}

int fun(int x)

{

if(x==1)

{

return 1;

}

else

{

x=x*fun(x-1);

}

return x;

}

What do you mean by derived data type in java?

A data type of an object describes the kind of information stored in that object. Numbers, strings, images, and all other information in a program is described by some sort of data type.

What are the different structures of programming?

Kinds of programming language construct : * block (1 kind, 2 facts) * class (15 kinds, 28 facts) - A software module that provides both procedural and data abstraction. It describes a set of similar objects, called its instances * comment (1 kind, 12 facts) * condition (3 kinds, 2 facts) * data item (2 kinds, 2 facts) * data type (1 kind, 3 facts) * declaration (1 kind, 2 facts) * exception (2 kinds, 5 facts) - A situation that arises in a program requiring special handling, and hence deviation from the normal path of control * function (1 kind, 2 facts) * keyword (1 kind, 2 facts) * name space (1 kind, 2 facts) * operator (1 kind, 2 facts) * package^2 (1 kind, 5 facts) - A facility for grouping a set of classes * procedure (2 kinds, 3 facts) * statement (10 kinds, 3 facts) Source: http://www.site.uottawa.ca:4321/oose/index.html#programminglanguageconstruct

Abap Program To find Factorial of number?

report zbharath.

data:num type i value 5,

fac type i value 0.

perform fact using num changing fac.

write:/ 'factorial of',num,'is',fac.

form fact.

using value(f-num) type i.

changing f-fact type i.

f-fact=1.

while f-num ge 1.

f-fact=f-fact*f-num.

f-num=f-num-1.

endwhile.

endform.

What is semi structured decision?

one in which the being who decides it does not have a realistic plan for maintaining/ achieving the object if decision

Is compiler a hardware?

Programming language compilers are application programs. In some publications, however, the term system software also includes software development tools (like a compiler, linker or debugger).

Is it possible to declare a variable in a method and use it in a main?

Yes you can and they are known as inner methods. You can even delcare an inner class and methods on it. However, if you want your classess accessible from multiple programs (reusability), then you should not use this practice. This type of facility is useful when you know for sure that your class or method is going to be used only once.

Write a program that prompts the user to enter an integer and determines whether it is divisible by 5 and 6 whether it is divisible by 5 or 6 and whether it is divisible by by 5 or 6 but not both?

#! /usr/bin/env ruby

n = gets.to_i

d = 'is not'

d = 'is' if n % 7 == 0

puts 'Your number ' + d + ' divisible by seven.'

For more accurate answer, please define the programming/script language you plan to use..

What are the characteristic features of c language?

  1. computers can understand and execute it directly
  2. it uses binary
  3. machine dependent
  4. time consuming

In which cases should you use the far pointers?

Far pointers are generally used with 16 bit windows application. You can also use for DOS based application for accessing VDU memory since it has huge pointer and it can be fit into the far pointers.

Well, Win32 does not distinguish between near and far addresses. Because the types NEAR and FAR are defined in WINDEF.H, they are automatically handled by the include file, which redefines them as empty strings for Win32. Thus, NEAR and FAR are ignored. If you do not include WINDEF.H, a convenient solution is to use the /D command-line option to replace the keywords by empty strings. For example:

/D_near= /D_far= /D__near= /D__far=

The increased address-space size in 32-bit Windows impacts 16-bit code in several ways:

Pointers are all 32 bits wide and are no longer near or far, and your code cannot make assumptions based on segmented memory. Window handles, handles to other objects (such as pens, brushes, and menus), and graphics coordinates have increased to 32 bits. Thus, you cannot use types such as WORD interchangeably with HWND as you could in 16-bit Windows. Message handlers must be rewritten because the different sizes can change the way information is packed in some message parameters. The larger size of graphics coordinates affects a number of function calls. The key areas of 16-bit code affected by these changes are:

Window procedure declarations, Near and far type declarations, Data types, Messages, Calls to API functions, WinMain function

Which flowchart symbol indicates the need to make a decision?

When there is a trigger for the event,:

Example:

When you need to determine if a grade passed or not.

Start->input grade(input or output)->is G>=75?(i just put 75 because the passing here is 75%, and use decision symbol, now there are two flowlines that will come out of the decision symbol, follow this: right- TRUE, down- FALSE, use a processing symbol then, if true...)->print pass(processing symbol, true, right of the DS, if false...)->print failed(processing symbol, false, down of the DS) then make sure that the end terminal would below the false, then in case you might wonder if the TRUE will be left, just use a flowline to connect it on the flowline before the end(i mean between the false Processing box and the end terminal)! So i hope that helps you!

Rekun- peace out!

Write a C program to find a given number is automorphic or not?

#include<stdio.h>

#include<conio.h>

void main()

{

int s,c,p,n,i,t;

printf("Enter a number:");

scanf("%d",&n);

s=n*n;

c=0;

p=1;

t=n;

while(n!=0)

{

c++;

n=n/10;

}

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

p=p*10;

if(s%p==t)

printf("The number is automorphic.");

else

printf("Not automorphic.");

getch();

}

How do you write a C program to print your name one hundred times?

Duhh..

printf("hello ");

printf("hello ");

printf("hello ");

printf("hello ");

printf("hello ");

printf("hello ");

printf("hello ");

printf("hello ");

printf("hello ");

Just kidding.

Just loop the printing.

int x = 0;

for(x = 0; x<11; x++)

{

printf("hello ");

}

and if you want each "hello" to be in a new line, use this:

printf("hello\n");

Linker and loader in c language?

There is no such thing in the C language, but it is true that operating systems have a component called loader which loads binary program-files (whose source may be written in C language) into the memory and prepares them to the execution.

How do you write a c program to print all prime numbers from 1 to n by using while loop with output?

100% working

void main()

{

int n,i=1,j,c;

clrscr();

printf("Enter Range To Print Prime Numbers")

scanf("%d",&n);

printf("Prime Numbers Are Following;

while(i<=n)

{

c=0;

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

{

if(i%j==0)

c++;

}

if(c==2)

printf("%d ",i)

i++;

}

getch();

}

How do you print 1 to 100 without using loop in c?

You can use recursion:

void printNum(int i)
{ if(i <= 100)
{ printf("%d\n", i);
printNum(i + 1); } }




int main()
{
printNum(1);

return 0;
}