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 will floating point value 5.375 be saved in memory that is its bit representation in memory?

5.37510 is 101.0112 Normalize and you get 1.01011E210 (1.010112 * 22) IEEE 754 single precision format is 1 Sign Bit, 8 Exponent Bits in excess 127 format, and 23 mantissa bits with leading implied one missing, so... Sign bit is 0 (+) Exponent is 10000001 (127 + 2) Mantissa is 0101100 00000000 00000000 (101011... with leading 1 omitted) Splice this together and you get 01000000 10101100 00000000 00000000 But in Little Endian machines, like Intel IA 32, you reverse the bytes, so you get 00000000 00000000 10101100 010000000 All of this said, however, you should not care what the bit representation is in memory, because that makes you platform dependent, i.e. non-portable.

Explain sequence point concept in C?

A sequence point is a point where all processing, including side-effects, has been completed before proceeding. It is important because if you have two expressions with side effects you do not necessarily know which one gets executed first unless you use an implicit or explicit sequence point.

Why you require different operating system for different compiler?

Actually it's the other way around. You require different compilers for different operating systems. The reason for this is that an operating system is basically an intermediate step for a person to be able to interact with the hardware on their system. Each OS has a different way to do this, and so compilers must be different for each one, even for the same language.

How do you program C keyboard output to kind of press the keys for you?

The answer to this will be platform and implementation dependent. For Windows machines, look into the keybd_event function: VOID keybd_event( BYTE bVk, // virtual key code BYTE bScan, // hardware scan code DWORD dwFlags, // special flags PTR dwExtraInfo // whether the key is pressed or released );

What is a wild card for one character?

wildcard character is a special character that represents one or more other characters. The most commonly used wildcard characters are the asterisk (*), which typically represents zero or more characters in a string of characters, and the questionmark (?), which typically represents any one character. For example, in searching: run* would mean "any word that starts with 'run' and has any kind of ending." If you entered "run*" at a search engine that offered a wildcard character capability, you would get results for run, runs, running, runner, runners - in short, any possible word that might begin with the three letters. Wildcard characters are used in regular expressions (a form of programming in which input data is modified based on specified patterns) and in searching through file directories for similar file names (for example, if all the work files on a project start with the characters "P5," you could easily locate all the project files by simply searching for "P5*"). A wildcard character is a type of meta character . In various games of playing cards, a wild card is a designated card in the deck of cards (for example, the two of spades) that can be used as though it were any possible card.
A question mark is used to match any single character. So:

b?b

would match bib, bob, and bub, but not bulb.

An asterisk matches zero or more characters. So:

s*d

would match sad, said, summed, and so forth.

bra*

would match bra (remember zero or more), brad, branch, and so forth.

Example of a letter with enumeration?

TRAVEL INCLUSIVE UNLIMITED

36 Jasper Street, marcaripe, Cayman Islands

Telephone 789 4531, 789 4563; Fax 7894563

Ref VM / CL256

March 18th, 2010

The Principal

St Antonio Girls Collage

36-38 Jasper Lands

OTAHEITE

St Thomas VI

ATTENTION: 'MR ROHIT RAMKISSIOON'

Dear Madam

We are happy to have your enquiry about our 2010 Summer Special Form One students.

I am enclosing the latest edition of 'Sunshine Destinations.' On page 6 you will find full details of the tour package. However, I must emphasize the following:

  1. An advance payment of 25% is required to initiate the booking process.
  2. The next instalment is 50% upon conformation of arrangements.
  3. The final payment is upon arrival and registration.
  4. Payments for additional services must be made on demand.
  5. Hotels in the country districts provide three meals per day. Most of them provide laundry facilities/services.

6. Tours leave at 09:00 daily and are expected to return by 17.00

7. Babysitting and geriatric car are available but arrangements should be made when booking. Please forward to us within seven days the details requested on page 16 of the brochure. Please provide the information exactly in the same order as shown in the sample booking form.

Yours sincerely

TRAVEL UNLIMITED

Wayne Morris

Manger

Encl

Can a Ladder Diagram be converted to C?

Do you mean Ladder diagram in PLC? Ladder diagram ia graphical representation of instructions in PLC. These instructions themselves are higher level and are different from assembler instructions of the microprocessor used. If you can get the Statement List form (I am using Siemens terminology), then it is easy to convert it into C language. But is it required? A person familiar with PLC architechture will find it much easy to deal with Statement List than C language instuctions. If you are a computer Pro, use something like Structured Text, SCL etc.

What is different between primitive date type and non primitive data type in c plus plus programming language?

A primitive data type is built into the language - int, char, long, etc.

A non-primitive data type is am abstract data type that is built out of primitive data types - linked list, queue, stack, etc.

What ORGANIC compound has C-C-C-O-C-C-C-C?

Please rephrase your question with more detail.

Making a LOT of assumptions, the answer MIGHT be propoxybutane.

How do you pass enum object as argument to function in c?

You can't pass an enum as an argument to a function. An enum in C isn't an object, it's a type. All you can do is pass a variable that is of the particular enum's type.

If you have never learned any programming languages is it good to start with C?

Yes, it's. But you have to be ready for some work to do because C is a beautiful language but it's not trivial.

What is the binary conversion of the decimal number 21.125?

21,125(10) = 0101,0010,1000,0101(2)

or if it was a floating point, then the answer is architecture-dependent, on my computer:

20 is 0000000000003440

21 is 0000000000003540

22 is 0000000000003640

21.5 is 0000000000803540

21.25 is 0000000000403540

21.125 is 0000000000203540

21.1 is 9a99999999193540

WHAT IS logic programming language?

There is such subject as mathematical logic there are used predicated and etc. to define simple things. There is programming languages that use the same elements and they are used in search algorithms, artificial intelligence and other fields.

One of the most know such languages is Prolog.

It's different from other programming languages because of predicates ideology. You could tell that John is a man, at later ask such questions is John a man, who is a man and etc.

For example:

likes(david, samanta).

likes(samanta, tom).

?- likes(david, samanta).

yes

?- likes(samanta, david).

no

?- likes(samanta, tom).

yes

What is the last digit of pie?

Pi doesn't have a last digit - it goes on for infinity (it also doesn't seem to repeat itself, so there can't even be a philosophical argument for the last digit).

Draw a flow chart that displays the first 8 fibnocci numbers?

//program that displays Fibonacci series using arrays[]

//author: me

#include

#include

#include

void main ( void )

{

clrscr();

unsigned long f[3];

int i=0,s=2;

f[0]=1,f[1]=1,f[2]=0;

while(i<10)

{

f[0]=f[1]+f[2];

cout<

f[1]=f[0]+f[2];

cout<

f[2]=f[0]+f[1];

cout<

i++;

s++;

}

getch();

}

What is idiometric expression?

An idiom is a phrase where the words together have a meaning that is different from the dictionary definitions of the individual words, which can make idioms hard for ESL students and learners to understand. Here, we provide a dictionary of 3,167 English idiomatic expressions with definitions

http://www.usingenglish.com/reference/idioms/

How do you access the screen with c program?

Depends on the operating system. In UNIX it's ncurses,see the manual.

What do you mean by Hierarchy in C language?

The preference in which arithematic operations are performed in an arithematic expression is called as Hierarchy of operations.

Its very important in C Programming to predefine the Hierarchy of operations to the C compiler in order to solve the given arithematic expression correctly.

e.g.: If a programmer wishes to perform ,z=a+b/c;it may beinterpretedas z=(a+b)/c or z=a+(b/c).

and if a=3,b=6,c=2 then using the same expression we will obtain two differentanswersas z=4.5 or z=6.

To avoid this condition we must be aware of hierarchy of operations used in C programming.

In arithematic expressions scanning is always done from left to right.

The priority of operations is as shown below,

Priority

Operators

First

Parenthesisos brackets()

Second

Multiplication & Division

Third

Addition & Subtraction

Fourth

Assignment i.e.=



If we consider the logical operators used in C language,the operator precedence will be like;



Operators

Type

!

Logical NOT

* / %

Arithmetic and moulus

+ -

Aritmetic

Relational

== !=

Relational

&&

Logical AND

Logical OR

=

Assignment



In the tables above,the higher the position of an operator,higher is its priority.

C code to find angle between hour hand and minute hand?

Lets start by thinking of a clock as a circle, with directly up being 0 degrees. At 12:00, both hands are at 0 pointing straight up. Every 60 minutes, the minute hand will make a complete revolution, so at any given time its angle is:

minute_deg = minute * 360 / 60 = minute * 6;

The hour hand will make a complete revolution every hour, so its formula is:

hour_deg = hour * 360 / 12 = hour * 30;

A function to find the angle would be:

int angleBetweenHands(int hour, int minute)

{

if(hour > 12) // In case of 24 hour clock

hour -= 12;

int angle = hour * 30 - minute * 6;

if(angle > 180)

angle = 360 - angle;

return(angle);

}

Why 1 is using as on state in binary language?

Computers are built off of electronic circuits, in which there is either no voltage or there is some positive number (usually 3.3V, 5V or 12V). 1 represents an electric charge while 0 represents no charge.

What programming language can create an operating system?

Any. As long as a language has the programming structures to access memory directly (DMA, IO ports, IRQ) AND it can be compiled (isn't run at a command interpretor) it can be used to create an operating system: the more general the language, the more platforms that OS can run on i.e. Binary/Machine Language is extremely hardware specific, Assembler less so, C (and Pascal and Fortran) even less so, C++/Smalltalk/Eiffel the least.

An OS doens't have to be 50 quintillion lines of code; the original Linux kernel and a few Gnu utilities ran on one floppy disk (1.44 meg), DOS 5 was 3 floppy disks, Windows 95 took about 150 meg on a CD, Windows NT about 300meg on CD, and so on. As each version of operating system grows in features, so does it storage footprint.

How do you convert a C program into a Linux kernel module?

Quick Answer: You don't.

Long Answer: It will need a fundamental change before you can have a module that does anything similar. Kernel modules don't have the same purpose as programs. Kernel Modules are meant for device support and similar things. More than likely you don't actually want to move the program to kernel space.