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.

22,510 Questions
C Programming

What are far pointers near pointers and huge pointers in C language?

"near" and "far" pointers are actually non-standard qualifiers that you'll find only on x86 systems. They reflect the odd segmentation architecture of Intel processors. In short, a near pointer is an offset only, which refers to an address in a known segment. A far pointer is a compound value, containing both a segment number and an offset into that segment.

Segmentation still exists on Intel processors, but it is not used in any of the mainstream 32-bit operating systems developed for them, so you'll generally only find the "near" and "far" keywords in source code developed for Windows 3.x, MS-DOS, Xenix/80286, etc.

AnswerA near pointer is a 16 bit pointer to an object contained in the current segment, be it code segment, data segment, stack segment, or extra segment. The compiler can generate code with a near pointer and does not have to concern itself with segment addressing, so using near pointers is fastest, and generates smallest code. The limitation is that you can only access 64kb of data at a time, because that is the size of a segment - 64kb. A near pointer contains only the 16 bit offset of the object within the currently selected segment.

A far pointer is a 32 bit pointer to an object anywhere in memory. In order to use it, the compiler must allocate a segment register, load it with the segment portion of the pointer, and then reference memory using the offset portion of the pointer relative to the newly loaded segment register. This takes extra instructions and extra time, so it is the slowest and largest method of accessing memory, but it can access memory that is larger than 64kb, sometimes, such as when dealing with video memory, a needful thing. A far pointer contains a 16 bit segment part and a 16 bit offset part. Still, at any one instant of time, without "touching" segment registers, the program only has access to four 64kb chunks, or segments of memory. If there is a 100kb object involved, code will need to be written to consider its segmentation, even with far pointers.

Now, segments overlap. Each segment is 64kb in length, but each one overlaps the next and the prior by 65520 bytes. That means that every address in memory can be addressed by 64kb-1 different combinations of segment:offset pairs. The result is that the total addressible memory was only 1mb, and the total usable memory address space was 500kb to 600kb. That sounds odd, but Intel built it, Microsoft wrote it, and DOS/Windows 3.1 grew up around it. I still have that computer, and it still works just fine, thank you. :-)>

Now the huge pointer. The far pointer suffers because you can not just add one to it and have it point the the next item in memory - you have to consider segment:offset rules, because of the 16 byte offset issue. The huge pointer is a monolithic pointer to some item with a large chunk of memory, and there are no segment:offset boundaries.

Beautiful - huhh?? - well, in order to get that, the pointer to segment:offset calculation has to be done every time you reference the pointer. It does allow you to create and manipulate a single monolithic object that is greater than 64kb, but it has its costs.

Answerhi akreeti, far pointers are the normalized pointers of four bytes which are used to access the main memory of the computer ...it can access both the data segment and code segment thus by modifing the offset u can modify refer two different addresses but refer to the same memory . soumya AnswerHi all, In a generic OS , memory is organised in a segment:offset fashion. Now say,it is of "X" MB and this "X" MB is made up of say "S" number of segments of each segment having "B" Bytes where S*B Bytes=X MB.

Near Pointer: A near pointer is that which will only point within the current segment say segment 3 (there are S number of segments numbered 0 to S-1) by containing only offset .

Far Pointer: A far pointer is that which will point anywhere in the X MB across segments by containing segment+offset .

The numbers X,S and B vary across diff operating system memory models under which you are programming .

Say for MS-DOS,X=1MB;B=16 Bytes and S=1Mega Bytes/16 Bytes . Here, near poinetr will have 4 bits to express address from 0 to 16 Bytes in a segment . Here, far pointer will have "l" bits for segment part of memory where 2^l=S (Here S should be a multiple of 16 bytes i.e; B=offset memory) and 4 bits for offset part of memory . so far poinetr will have l+4 bits .

Thanks Chandra

AnswerIn DOS only 1 mb (10,48,580 bytes) of memory is accessible. Any of these memory locations are accessed using CPU registers. Under DOS the CPU registers are only 16 bits long. Therefore, the minimum value present in a CPU register could be 0, and maximum 65,535. Then how do we access memory locations beyond 65535th byte? By using two registers (segment and offset) in conjunction. For this the total memory (1 mb) is divided into a number of units each comprising 65,536 (64 kb) locations. Each such unit is called a segment. Each segment always begins at a location number which is exactly divisible by 16. The segment register contains the address where a segment begins, whereas the offset register contains the offset of the data/code from where the segment begins. For example, let us consider the first byte in B block of video memory. The segment address of video memory is B0000h (20-bit address), whereas the offset value of the first byte in the upper 32K block of this segment is 8000h. Since 8000h is a 16-bit address it can be easily placed in the offset register, but how do we store the 20-bit address B0000h in a 16-bit segment register? For this out of B0000h only first four hex digits (16 bits) are stored in segment register. We can afford to do this because a segment address is always a multiple of 16 and hence always contains a 0 as the last digit. Therefore, the first byte in the upper 32K chunk of B block of video memory is referred using segment:offset format as B000h:8000h. Thus, the offset register works relative to segment register. Using both these, we can point to a specific location anywhere in the 1 mb address space.

Suppose we want to write a character `A' at location B000:8000. We must convert this address into a form which C understands. This is done by simply writing the segment and offset addresses side by side to obtain a 32 bit address. In our example this address would be 0xB0008000. Now whether C would support this 32 bit address or not depends upon the memory model in use. For example, if we are using a large data model (compact, large, huge) the above address is acceptable. This is because in these models all pointers to data are 32 bits long. As against this, if we are using a small data model (tiny, small, medium) the above address won't work since in these models each pointer is 16 bits long.

What if we are working in small data model and still want to access the first byte of the upper 32K chunk of B block of video memory? In such cases both Microsoft C and Turbo C provide a keyword called far.

Answernormally Pointers are 32 bit length. which are divided as segment and offset.

which are represent as

seg : off 0000:0000 . . . 8000:FFFF. . . . FFFF:FFFF

first 4 hexa digits are segment, last 4 hexa digits are offset

C Program will allocate 64KB (only one segment) memory for data Part (dynamic memory allocation, Local variables).

by using 16 bit we can access that memory that's called near pointer(16 bit pointer).

suppose we need more than 64KB memory to a program / we want to access a particular memory location (in TSR Program)

at the time we neet 32 bit pointer. through 32 bit pointer we can access any segment and offset address.

there are 2 types of 32 bit pointers 1. far pointer. 2. Huge Pointer.

In TSR programming normally we use far Pointer.

The Main Difference between Far and Huge Pointer is

Far pointers are not Normalized.

Huge pointers are Normalized.

AnswerFirst let me state this is based on my current understanding. If someone can update or improove my version I will be grateful:

1.For those in hurry far simply means "its not here find it somewhere else in memory" 2. far, near and huge and not a part of the C standard( am I right?)

-So the answer to this is: "It depends" Its highly compiler specific and platform(processor) specific.

Different processors have different ways to handle memory, and also different amount of memory.

when you say "far" you are just telling the compiler find or put this data somewhere else.But the compiler does the hard work for you: writing the instructions to change the segment properly and accessing the correct memory location for you..and that's because it knows the processor..

I think previous answers are mostly related to Pentium family of processors..and perhaps turbo C or similar compilers.But remember that is only one of them!

Below are the examples which perhaps can have different meanings in different places:

1. far int* near a; 2. far int* a; 3. far int *far a;

So the best way is to try out with your compiler and find out

hope that helped!

AnswerPointers can either be near, far, or huge. Near pointers refer to the current segment, so neither DS nor CS must be modified to dereference the pointer. They are the fastest pointers, but are limited to point to 64 kilobytes of memory (the current segment).

Far pointers contain the new value of DS or CS within them. To use them the register must be changed, the memory dereferenced, and then the register restored. They may reference up to 1 megabyte of memory. Note that pointer arithmetic (addition and subtraction) does not modify the segment portion of the pointer, only its offset. Operations which exceed the bounds of zero or 65535 (0xFFFF) will undergo modulo 64K operation just as any normal 16 bit operation.

For example, the code below will wrap around and overwrite itself: char far* myfarptr = (char far*) 0x50000000L ; unsigned long counter ; for(counter=0; counter<128*1024; counter++) // access 128K memory *(myfarptr+counter) = 7 ; // write all 7s into it

The moment counter becomes (0x10000), the resulting absolute address will roll over to 0x5000:0000.

Huge pointers are essentially far pointers, but are normalized every time they are modified so that they have the highest possible segment for that address. This is very slow but allows the pointer to point to multiple segments, and allows for accurate pointer comparisons, as if the platform were a flat memory model: It forbids the aliasing of memory as described above, so two huge pointers that reference the same memory location are always equal.

This near, far & huge pointers comes only in DOS or other, which have only less memory accessible. In DOS only 1 Mb ( 10,48,580 Bytes) of memory is accessible. Any of these memory location are accessed using CPU registers. Under DOS the CPU registers are only 16 bits long. Therefore, the minimum value present in a CPU register is 0, and maximum is 65,535. If we want to access more than 65,535 ? how to ? We can do this by - using two registers ( Segment & Offset ). Here memory is divided into 64 Kb locations or chunks. C Program will allocate 64KB (only one segment) memory for data Part (dynamic memory allocation, Local variables). by using 16 bit we can access that memory that's called near pointer(16 bit pointer). suppose we need more than 64KB memory to a program / we want to access a particular memory location (in TSR Program) at the time we need 32 bit pointer. through 32 bit pointer we can access any segment and offset address. The Main Difference between Far and Huge Pointer is Far pointers are not Normalized. Ex: TSR Programs use Far Pointers Huge pointers are Normalized. I think by this u can have brief idea about near, far & huge pointers. According to my knowledge far pointers are mainly used to build I/O commands.Such as you can write "printf" function by using far pointer void main() { char far *vdu=0xB8000000; *(vdu+2)='a'; } If you run this program in C,you can see "a" in the DOS screen There are 2 blocks of memory above the 640KB RAM of 64KB each. The first 32KB are used by MA, rest by CGA/EGA/VGA. The "far" pointer is used to access the VDU memory directly. Hence the displaying functions or output functions are not required.

AnswerOn 16-bit operating systems, a huge pointer allows the developer to access a single block of memory that's larger than 64 kilobytes in size.
678679680
Microsoft Windows
C Programming

What are near far and huge pointers in C?

A near pointer is a 16 bit pointer to an object contained in the current segment, be it code segment, data segment, stack segment, or extra segment. The compiler can generate code with a near pointer and does not have to concern itself with segment addressing, so using near pointers is fastest, and generates smallest code. The limitation is that you can only access 64kb of data at a time, because that is the size of a segment - 64kb. A near pointer contains only the 16 bit offset of the object within the currently selected segment.

A far pointer is a 32 bit pointer to an object anywhere in memory. In order to use it, the compiler must allocate a segment register, load it with the segment portion of the pointer, and then reference memory using the offset portion of the pointer relative to the newly loaded segment register. This takes extra instructions and extra time, so it is the slowest and largest method of accessing memory, but it can access memory that is larger than 64kb, sometimes, such as when dealing with video memory, a needful thing. A far pointer contains a 16 bit segment part and a 16 bit offset part. Still, at any one instant of time, without "touching" segment registers, the program only has access to four 64kb chunks, or segments of memory. If there is a 100kb object involved, code will need to be written to consider its segmentation, even with far pointers.

Now, segments overlap. Each segment is 64kb in length, but each one overlaps the next and the prior by 65520 bytes. That means that every address in memory can be addressed by 64kb-1 different combinations of segment:offset pairs. The result is that the total addressible memory was only 1mb, and the total usable memory address space was 500kb to 600kb. That sounds odd, but Intel built it, Microsoft wrote it, and DOS/Windows 3.1 grew up around it. I still have that computer, and it still works just fine.

Now the huge pointer. The far pointer suffers because you can not just add one to it and have it point the the next item in memory - you have to consider segment:offset rules, because of the 16 byte offset issue. The huge pointer is a monolithic pointer to some item with a large chunk of memory, and there are no segment:offset boundaries.

Well, in order to get that, the pointer to segment:offset calculation has to be done every time you reference the pointer. It does allow you to create and manipulate a single monolithic object that is greater than 64kb, but it has its costs. Far pointers are the normalized pointers of four bytes which are used to access the main memory of the computer ...it can access both the data segment and code segment thus by modifing the offset you can modify refer two different addresses but refer to the same memory .

In a generic OS , memory is organised in a segment:offset fashion. Now say, it is of "X" MB and this "X" MB is made up of say "S" number of segments of each segment having "B" Bytes where S*B Bytes=X MB.

Near Pointer: A near pointer is that which will only point within the current segment say segment 3 (there are S number of segments numbered 0 to S-1) by containing only offset .

Far Pointer: A far pointer is that which will point anywhere in the X MB across segments by containing segment+offset .

The numbers X,S and B vary across diff operating system memory models under which you are programming .

Say for MS-DOS,X=1MB;B=16 Bytes and S=1Mega Bytes/16 Bytes . Here, near pointer will have 4 bits to express address from 0 to 16 Bytes in a segment . Here, far pointer will have "l" bits for segment part of memory where 2^l=S (Here S should be a multiple of 16 bytes i.e; B=offset memory) and 4 bits for offset part of memory, so far poinetr will have l+4 bits.

In DOS only 1 mb (10,48,580 bytes) of memory is accessible. Any of these memory locations are accessed using CPU registers. Under DOS the CPU registers are only 16 bits long. Therefore, the minimum value present in a CPU register could be 0, and maximum 65,535. Then how do we access memory locations beyond 65535th byte? By using two registers (segment and offset) in conjunction. For this the total memory (1 mb) is divided into a number of units each comprising 65,536 (64 kb) locations. Each such unit is called a segment. Each segment always begins at a location number which is exactly divisible by 16. The segment register contains the address where a segment begins, whereas the offset register contains the offset of the data/code from where the segment begins. For example, let us consider the first byte in B block of video memory. The segment address of video memory is B0000h (20-bit address), whereas the offset value of the first byte in the upper 32K block of this segment is 8000h. Since 8000h is a 16-bit address it can be easily placed in the offset register, but how do we store the 20-bit address B0000h in a 16-bit segment register? For this out of B0000h only first four hex digits (16 bits) are stored in segment register. We can afford to do this because a segment address is always a multiple of 16 and hence always contains a 0 as the last digit. Therefore, the first byte in the upper 32K chunk of B block of video memory is referred using segment:offset format as B000h:8000h. Thus, the offset register works relative to segment register. Using both these, we can point to a specific location anywhere in the 1 mb address space.

Suppose we want to write a character `A' at location B000:8000. We must convert this address into a form which C understands. This is done by simply writing the segment and offset addresses side by side to obtain a 32 bit address. In our example this address would be 0xB0008000. Now whether C would support this 32 bit address or not depends upon the memory model in use. For example, if we are using a large data model (compact, large, huge) the above address is acceptable. This is because in these models all pointers to data are 32 bits long. As against this, if we are using a small data model (tiny, small, medium) the above address won't work since in these models each pointer is 16 bits long.

What if we are working in small data model and still want to access the first byte of the upper 32K chunk of B block of video memory? In such cases both Microsoft C and Turbo C provide a keyword called far.

normally Pointers are 32 bit length. which are divided as segment and offset.

which are represent as

seg : off 0000:0000 . . . 8000:FFFF. . . . FFFF:FFFF

first 4 hexa digits are segment, last 4 hexa digits are offset

C Program will allocate 64KB (only one segment) memory for data Part (dynamic memory allocation, Local variables).

by using 16 bit we can access that memory that's called near pointer(16 bit pointer).

suppose we need more than 64KB memory to a program / we want to access a particular memory location (in TSR Program)

at the time we neet 32 bit pointer. through 32 bit pointer we can access any segment and offset address.

there are 2 types of 32 bit pointers 1. far pointer. 2. Huge Pointer.

In TSR programming normally we use far Pointer.

The Main Difference between Far and Huge Pointer is

Far pointers are not Normalized.

Huge pointers are Normalized.

First let me state this is based on my current understanding. If someone can update or improve my version I will be grateful:

1.For those in hurry far simply means "its not here find it somewhere else in memory" 2. far, near and huge and not a part of the C standard( am I right?)

-So the answer to this is: "It depends" Its highly compiler specific and platform(processor) specific.

Different processors have different ways to handle memory, and also different amount of memory.

when you say "far" you are just telling the compiler find or put this data somewhere else.But the compiler does the hard work for you: writing the instructions to change the segment properly and accessing the correct memory location for you..and that's because it knows the processor..

I think previous answers are mostly related to Pentium family of processors..and perhaps turbo C or similar compilers.But remember that is only one of them!

Below are the examples which perhaps can have different meanings in different places:

1. far int* near a; 2. far int* a; 3. far int *far a;

So the best way is to try it out with your compiler and find out.

Pointers can either be near, far, or huge. Near pointers refer to the current segment, so neither DS nor CS must be modified to dereference the pointer. They are the fastest pointers, but are limited to point to 64 kilobytes of memory (the current segment).

Far pointers contain the new value of DS or CS within them. To use them the register must be changed, the memory dereferenced, and then the register restored. They may reference up to 1 megabyte of memory. Note that pointer arithmetic (addition and subtraction) does not modify the segment portion of the pointer, only its offset. Operations which exceed the bounds of zero or 65535 (0xFFFF) will undergo modulo 64K operation just as any normal 16 bit operation.

For example, the code below will wrap around and overwrite itself: char far* myfarptr = (char far*) 0x50000000L ; unsigned long counter ; for(counter=0; counter<128*1024; counter++) // access 128K memory *(myfarptr+counter) = 7 ; // write all 7s into it

The moment counter becomes (0x10000), the resulting absolute address will roll over to 0x5000:0000.

Huge pointers are essentially far pointers, but are normalized every time they are modified so that they have the highest possible segment for that address. This is very slow but allows the pointer to point to multiple segments, and allows for accurate pointer comparisons, as if the platform were a flat memory model: It forbids the aliasing of memory as described above, so two huge pointers that reference the same memory location are always equal.

This near, far & huge pointers comes only in DOS or other, which have only less memory accessible. In DOS only 1 Mb ( 10,48,580 Bytes) of memory is accessible. Any of these memory location are accessed using CPU registers. Under DOS the CPU registers are only 16 bits long. Therefore, the minimum value present in a CPU register is 0, and maximum is 65,535. If we want to access more than 65,535 ? how to ? We can do this by - using two registers ( Segment & Offset ). Here memory is divided into 64 Kb locations or chunks. C Program will allocate 64KB (only one segment) memory for data Part (dynamic memory allocation, Local variables). by using 16 bit we can access that memory that's called near pointer(16 bit pointer). suppose we need more than 64KB memory to a program / we want to access a particular memory location (in TSR Program) at the time we need 32 bit pointer. through 32 bit pointer we can access any segment and offset address. The Main Difference between Far and Huge Pointer is Far pointers are not Normalized. Ex: TSR Programs use Far Pointers Huge pointers are Normalized. I think by this u can have brief idea about near, far & huge pointers. According to my knowledge far pointers are mainly used to build I/O commands.Such as you can write "printf" function by using far pointer void main() { char far *vdu=0xB8000000; *(vdu+2)='a'; } If you run this program in C,you can see "a" in the DOS screen There are 2 blocks of memory above the 640KB RAM of 64KB each. The first 32KB are used by MA, rest by CGA/EGA/VGA. The "far" pointer is used to access the VDU memory directly. Hence the displaying functions or output functions are not required.

On 16-bit operating systems, a huge pointer allows the developer to access a single block of memory that's larger than 64 kilobytes in size.

----------------------------------------------------------------------------------------------------------------

With the development of Intel's 80386 and later microprocessors that support the flat memory addressing model these variants of pointers became unnecessary and most modern C compilers no longer support them. While many modern compilers do accept this syntax for backward compatibility with old source code, they ignore them and treat all three just as ordinary pointers that can access any location in memory.

640641642
C Programming

How string constants are declared in c?

A string constant is simply an array of char, with constant value.

char abc[] = "This is a test";

395396397
Computer Programming
C Programming
JavaScript

Write a c program to print factorial?

hope you like the answers

359360361
Computer Terminology
C Programming
Computer Science

What are differences between linker and loader in C?

Neither linker or loader is part of the C language, they are platform-dependent utility programs.

Linker (or binder) creates an executable from object modules and libraries; loader loads these executables into memory, resolves their shared-library-dependencies, and initiates their execution.

355356357
C Programming
Education
English Alphabet History

What capital letters look the same in the mirror?

  • A
  • H
  • I
  • M
  • O
  • T
  • U
  • V
  • W
  • X
  • Y
110111112
Java Programming
C Programming

What is the default return type of main?

'Main' is not at all associated with the return type. Specifying a function as main means that the function is to be executed first when the class is executed. A program can have only one 'main' function.

Answer:

The C standard ISO/IEC 9899 dictates that the return type of main() should be int.

Edited by Vijay Duggirala

It is void for Java. Which means that main in java returns no value.

341342343
Java Programming
C Programming

What is an element in the Array?

An Array is a data type that stores multiple values in one variable. It can be thought of as a bunch of values that are related to one another and will be used together. Every value in the array is called an array element. They can be referred to or accessed by using their index position in the array.

339340341
C Programming
C++ Programming

How do you run a c program in turbo c plus plus?

You can directly press ctrl + f9 on your keyboard or you can go to the menu and then click on RUN.

337338339
C Programming
Intel 8086 and 8088

What is execution unit and bus interface unit?

In the 8086/8088, the execution unit is the part of the processor known as the CPU. It executes the instructions and generates the results. The bus interface unit, on the other hand, is the part of the processor that handles reading and writing to memory. The two are somewhat loosely coupled, with the bus interface unit attempting to always be ahead of the execution unit, i.e. using the cache, so that the execution unit's wait time is minimized and performance is maximized.

337338339
Computer Programming
C Programming

How can you define null statement in loop in C programming?

If you are using for loop

for(;;);

or

you can also define condition and iterations but the loop has to close there itself without any statement inside it.

In the similar way you can define while and do while loop without any statement.

337338339
C Programming

What is an example of lack of orthogonality in C?

Orthogonality is to do with a right angle, what has orthogonality got to do with general computer programming?

I fear this is another badly asked question by someone engaged in homework avoidance and that the quality of the question indicates the success of previous

homework avoidance.

335336337
Computer Programming
C Programming

Do while loop program in C for printing the even numbers?

main()

{

int n,i=1;

printf("Enter the Number till you want to print even numbers");

scanf("%d",&n);

printf("Even Numbers till %d are",n);

while(i

{

if((i%2)==0)

printf("%d",i);

i++;

}

}

OR

main()

{

int n,i=1;

printf("Enter the Number till you want to print even numbers");

scanf("%d",&n);

do

{

if(i%2==0)

printf("%d",i);

i++;

}while(i

}

OR

void main()

{

int i=0,n;

printf("Enter the number till you want to print even numbers:");

scanf("%d",&n);

do

{

printf("%d\t",i);

i+=2;

}while(i<=n);

}

333334335
Computer Programming
Java Programming
C Programming

Why are local variable stored on stack?

Because they are created and destroyed on 'last-in-first-out' principle.

327328329
Computer Programming
Education
C Programming

What is linker?

C language has a function that contains the object code for predefined functions.for example,the printf() is a library function.if the C program uses any of the library functions, the object code produced for the source code should be combined with the object code of the library functions to generate the final executable code.this process is called linking and it is performed by a 'linker'.

315316317
Database Programming
C Programming

Write a program in c language to add two numbers?

//program to add two numbers

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c;

clrscr(): //its prototype or header file is conio.h

printf("\n enter first number :"); //its prototype or header file is stdio.h

scanf("%d",&a); //its prototype or header file is stdio.h

printf("\n enter second number :"); //its prototype or header file is stdio.h

scanf("%d",&b); //its prototype or header file is stdio.h

c=a+b;

printf("\n the sum of two numbers is :%d",c); //its prototype or header file is stdio.h

getch(); //its prototype or header file is conio.h

}

325326327
Software and Applications (non-game)
Math and Arithmetic
C Programming
Numbers
Percentages, Fractions, and Decimal Values

Convert the hexadecimal number BA to decimal?

BA = 11*16 + 10 = 176 + 10 = 186

319320321
Java Programming
C Programming
Electrostatics

What is static?

A atom consist out of 2 parts where as the centre is called the nucleus which is form out of Protons and neutrons and the outer part that orbits the nucleus is Electrons. Protons is positively charged, Electrons is negatively charged and neutrons well you guessed it, its neutral. When 2 or more objects that is not earth bound is in constant contact or rubbed against each other, the Electrons from one of the objects is transferred to the other object and thus that object has more Electrons than Protons and thus it has a negative charge and the other object has a positive charge as it has no more Protons than Electrons. Protons doesn't normally get transferred from object to object as it is normally held firm to the Atom. Opposite objects attract each other while the same charge repel each other but a neutral object will attract both positive and negative charged objects. When a charged object is in contact with a different charged object a discharge will take place and thus static electricity will take place.
Static menu: All patrons are offered the same foods every day. Once a static menu is developed and established, it rarely changes. Static menus are typically found in fast-food operations, ethnic restaurants, steakhouses and the like. Static menus can also be in institutional settings. For example, a static menu at an elementary school could offer students, along with vegetable and dessert, the same luncheon choices every school day: a cheeseburger, fish sticks, chicken tacos, pizza wedges or a sandwich.

317318319
Math and Arithmetic
Java Programming
C Programming

Why do we use double in java but do not use float?

Double is more precise than float. The 4 bytes saved on a float are usually not very relevant. However, if you need to save large amounts of numbers (e.g. in an array), and you don't need the extra precision, you might save some memory by using float.

309310311
Math and Arithmetic
C Programming

Flow chart to reverse digits of numbers?

ALGORITHM REVERSE

INPUT (string)

"STRINGLENGTH() would be a function that returns the lenght of the string"

FOR (i = STRINGLENGTH(string); i >= 0; i--) BEGIN

DISPAY (string[i])

END FOR

END REVERSE

315316317
C Programming

What is the meaning of percent d in c language?

This is found in the printf family of functions. The % is just a flag that says that the next character specifies a variable type.

%c character

%d signed integers

%i signed integers

%e scientific notation, with a lowercase "e"

%E scientific notation, with a uppercase "E"

%f floating point

%g use %e or %f, whichever is shorter

%G use %E or %f, whichever is shorter

%o octal

%s a string of characters

%u unsigned integer

%x unsigned hexadecimal, with lowercase letters

%X unsigned hexadecimal, with uppercase letters

%p a pointer

%n the argument shall be a pointer to an integer into which is placed the number of characters written so far

%% a '%' sign

311312313
Software and Applications (non-game)
C Programming

Steps how to quit a computer program?

on a mac you can click COMMAND Q (file, quit....) on a PC you can click ALT F4 (you also can just press X on the top right side)

313314315
C Programming

What is meant by C-language in computer science?

Firstly computer science is nothing but the science of computer. In earlier days computer were big boxes of circuits.

If you ignore the problem of their size the big problem with them was that programmeres were not able to program them or interact with them.

After that many programming languages were built to make the programming task easier.

But when C language was released it changed the whole game. Now the programming was not only easy to do but also easy to learn.

311312313
Computer Programming
C Programming

What are the factors that determine the choice of programming language when developing an application?

What programming language you know would be a good place to start.

310311312
Math and Arithmetic
C Programming

WAP to find number of digit in a number?

The core of it:

for (ndig=1; (n/=10)!=0; ++ndig);

309310311

Copyright © 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.