turbo-c

Turbo C++: Why does printf print expected values, when no variables are passed to it?

こ雲淡風輕ζ 提交于 2019-11-27 15:13:32
A question was asked in a multiple choice test: What will be the output of the following program: #include <stdio.h> int main(void) { int a = 10, b = 5, c = 2; printf("%d %d %d\n"); return 0; } and the choices were various permutations of 10, 5, and 2. For some reason, it works in Turbo C++, which we use in college. However, it doesn't when compiled with gcc (which gives a warning when -Wall is enabled) or clang (which has -Wformat enabled and gives a warning by default) or in Visual C++. The output is, as expected, garbage values. My guess is that it has something to do with the fact that

Cannot run c graphics programs

a 夏天 提交于 2019-11-27 07:09:14
问题 I have developed a graphic program on a desktop system. But when I tried to run it on the hp compaq laptop it's not getting executed. I developed it using Turbo C. Then i tried writing a simple graphic program in Turbo C on the laptop, but the problem I am getting is in 'initgraph' statement it is unable to detect the driver. Can you please tell me what might be the problem? 回答1: Turbo-C, much like my first girlfriend, will always have a special place in my heart. But its time to let her go.

How to fix “unable to open stdio.h in Turbo C” error?

拥有回忆 提交于 2019-11-27 06:08:09
问题 Whenever I compile my program, I get the error above. 回答1: If you have problems like that, first of all your TC folder put in to the C:..drive. after completing installation open turbo c blue screen. there is a OPTIONS > Directories ..in that you can see for option to set up path.. include directories..you can set path there now.. C:\TC\INCUDE libraries Directories..you can set path there... C:\TC\LIB if you want to store your output in BIN then you can set.. C:\TC\BIN ..otherwise you can set

Errors using ternary operator in c

血红的双手。 提交于 2019-11-27 05:36:07
I have a piece of code in C given as follows : main() { int a=10, b; a>=5 ? b=100 : b=200 ; printf("%d" , b); } running the code on gcc compiler in unix generates the compile-time error as 'lvalue required as left operand of assignment' and points the error at b = 200 whereas in windows compiling using Turbo C gives 200 as output. Can anybody please explain what exactly is happening in this case ? In C the ternary operator is defined like logical-OR-expression ? expression : conditional-expression where conditional expression is defined like logical-OR-expression The assignment operator has a

Shouldn't an int pointer in Turbo C be of size 4 bytes?

。_饼干妹妹 提交于 2019-11-26 18:38:55
问题 In the Turbo C compiler, the size of an int pointer is shown as 2 bytes when sizeof() operator is used. Now, if I print the address of an int variable, it comes out to be a hexadecimal number of 8 digits, which makes the size of address to be 32 bits (or 4 bytes). So, why is the Turbo compiler showing 2 bytes size for the pointer? 回答1: Your program is compiled under the small memory model, meaning that your entire data space takes up no more than 64K of space. When the program starts, the DS

How to enable linking floating point library in TurboC?

人走茶凉 提交于 2019-11-26 17:18:44
问题 I'm newbie in C language... Just want to ask how to enable linking floating point library in TurboC? 回答1: From the comp.os.msdos.programmer FAQ: "Floating point formats not linked" is a Borland run-time error (Borland C or C++, Turbo C or C++). Borland's compilers try to be smart and not link in the floating- point (f-p) library unless you need it. Alas, they all get the decision wrong. One common case is where you don't call any f-p functions, but you have %f or other f-p formats in scanf()

Turbo C++: Why does printf print expected values, when no variables are passed to it?

风流意气都作罢 提交于 2019-11-26 17:05:03
问题 A question was asked in a multiple choice test: What will be the output of the following program: #include <stdio.h> int main(void) { int a = 10, b = 5, c = 2; printf("%d %d %d\n"); return 0; } and the choices were various permutations of 10, 5, and 2. For some reason, it works in Turbo C++, which we use in college. However, it doesn't when compiled with gcc (which gives a warning when -Wall is enabled) or clang (which has -Wformat enabled and gives a warning by default) or in Visual C++. The