Questions tagged [c89]

This tag is for questions regarding the international standard ISO 9899:1990, also known as "C89", "C90" or "ANSI C", with amendments and technical corrigenda (as opposed to K&R C, C99, C11 or later C standard revisions).

The first C standard was released 1989 nationally in USA, by their national standard institute ANSI. This release is called C89 or ANSI-C. One year later, the American standard was accepted internationally and published by ISO (ISO 9899:1990). This release is called C90. Technically, it is the same standard as C89/ANSI-C, though formally, C90 replaced C89/ANSI-C, making them obsolete.

Always use the tag for all your C questions, then complement it with the tag for questions that are specific to this version of the standard.

643 questions
-1
votes
1 answer

calling scanf inside do while loop is breaking the loop

I have a do while loop. When I run it without scanf(), it runs properly. But if I enter a scanf() it breaks the loop! Why??? The code: With scanf() void main(){ int num = prng() % 100, guessed, guesses = 0; bool win = false; …
-1
votes
3 answers

Parse a string in C89/C90

I'm parsing a string into variables and I almost have what I want. The string to be parsed looks like this char [128] = "D4 E 3 NullByte Sub"; Now I would like to split this into 4 variables: D4 would be the location E would be the direction 3…
Argon
  • 55
  • 1
  • 7
-1
votes
2 answers

get root directory in any operating sytem

Is there is any way to get the DIR pointer to the root directory, no matter what the operating system? preferably without the macros checking like so #ifdef _WIN32 #endif (etc..) so for example in windows pointer to the C/ folder will be returned.
avivgood2
  • 227
  • 3
  • 19
-1
votes
2 answers

Alternative to dir command to query a directory in C

I am trying to create a program where the user can add different path regex-s so that a specific set of operations on the files that match the regex. I tried using opendir() of the dirent.h header file but soon realized that it does not use the…
-1
votes
1 answer

Declaration of function shadows a global declaration

Because this is a common error message, I've Googled the issue. Unfortunately, all I could find were threads wherein the issue arose from global and local variables having the same name. My problem has nothing to do with global variables, so I…
Display name
  • 257
  • 2
  • 8
-1
votes
1 answer

Array increment doesnt give the correct value

This is a very strange problem. I cannot see any differences between code1 and code2 . However, there should be a difference because they produce different results : (notice f0 and f0A (acts as a buffer)) code1 : for (k = 0; k < 6; k++) { …
Yassine
  • 3
  • 4
-1
votes
1 answer

Code doesn't get excuted after using continue in while loop

I wrote the following code using a complier which was configured to be suitable with c89 standard using eclipse. #include int main(void) { int i=0; printf("initial value for variable i is: %d\n",i); while (i<3) { …
daniel
  • 1
-1
votes
2 answers

writing a code that checks an ascending sequence only using loops and condition statments only

I was asked to write a code in c language that checks a certain alphabetical order from the input and determines how many "legal" orders are there. the order goes like this: I receive multiple inputs of both numbers(from 1-9) and letters(from A-Z)…
-1
votes
1 answer

Program crashed for calling execvp to compile a program with error?

I use execvp to compile a program with error. But then error message pop on my terminal screen which should not happen because if execvp fails, it will only let child return with exit status. I do not understand why my terminal will actually show…
kluo
  • 131
  • 1
  • 10
-1
votes
1 answer

Should I redeclare a part of an external array for the use in a module

Let's say I have thre project wide variable blocks with external linkage vByte[1000], vWord[1000] and vQword[1000]. And because of the lack of a better debug solution, every variable that I want to see at runtime has to be in those blocks. Now I…
Kami Kaze
  • 2,069
  • 15
  • 27
-1
votes
1 answer

How to transfer a char in C to an array of char?

Say I have: .... char aLine; char inputLine[1000]; scanf("%c", &aLine); .... Now, I want to convert aLine into an array of char so that I can count how many characters in aLine. How can i do this?
kluo
  • 131
  • 1
  • 10
-1
votes
1 answer

Allocating 2D array of dimensions read from file

I would like to read 2 numbers n,m from text file and then allocate a 2D array with n rows and m columns. Also, I would like to initialise the array in my main function in order to use it later in other functions, and do the reading and allocating…
Itay4
  • 231
  • 1
  • 6
  • 14
-1
votes
1 answer

Hidden printable text

I build a small program that simply copy the text from an input.txt file to an output.txt file. It works with no apparent problem with the command: ./myCopier.txt < rand.txt > randout.txt on a GCC89 compiler, used for didactic…
Worice
  • 3,847
  • 3
  • 28
  • 49
-1
votes
2 answers

Timer based interrupt in PIC microcontroller using mikroC for PIC

I am facing a problem while implementing a timer based interrupt in mikroC for PIC. I want to toggle a port pin for 8 times if there is a keypress at PORTC.F0 and there should be a delay of say 100ms between the toggles. Normally this would be very…
Ace
  • 11
  • 4
-1
votes
3 answers

'error ";" expected' when initialising multiple structs

I have typdef'd a struct, and immediately below this I've simultaneously declared and initialised the variables I want using the typedef'd struct. When I try to compile the code, there are no error messages relating to 'hi_aud', but the rest of the…