Questions tagged [ansi-c]

ANSI C is an informal term sometimes used when referring to the C programming language standard published by the American National Standards Institute (ANSI) in 1989 .

"ANSI C" is an informal term used to refer to the 1989 version of the C language. The formal name for this version of the language is ISO/IEC 9899:1990. Informally it is also known as "C89" or "C90".

This is because the American National Standards Institute (ANSI) first published this standard in the year 1989, as a national standard for the USA. It became international ISO standard in the year 1990. So ANSI C, C89 and C90 all refer to the same technical standard.

It is a common misunderstanding that "ANSI C" means standard compliant C. The ANSI standard institute haven't had anything to do with C since 1989. The language is maintained by ISO SC22/WG14. Yet the term "ANSI C" is sometimes used to mean standard compliant, particularly in old books and by old compilers.

Because of this ambivalent meaning, please avoid using this tag. For questions regarding the C89/C90 version of the C language, please use . For questions regarding standard-compliant C, simply use the tag.

Further information about the different C standard versions.

618 questions
1
vote
2 answers

Resources to Write ANSI C Code

The last time I heavily used C was years ago, and it was strictly done on the Windows platform. Now, I am taking a class where it is required to develop programs to be ANSI C compliant and the code will be compiled using gcc we a are required to…
Nahum
  • 6,959
  • 12
  • 48
  • 69
1
vote
2 answers

ANSI C + Numerical Linear Algebra - Using a linear solver to find an eigenvector given an eigenvalue (issue)

I have written a linear solver employing Householder reflections/transformations in ANSI C which solves Ax=b given A and b. I want to use it to find the eigenvector associated with an eigenvalue, like this: (A-lambda*I)x = 0 The problem is that the…
nick_name
  • 1,353
  • 3
  • 24
  • 39
1
vote
3 answers

How to convert char pointer into char in C Open VMS

This is to convert from char pointer into char. I followed the codes from another topic but it seems like it's not working to me. I am using Open VMS Ansi C compiler for this. I don't know what's the difference with another Platform. main(){ char *…
user692121
1
vote
2 answers

Porting an OS wrapper gives my identical function names

Porting an OS abstraction layer (from an embedded environment) to windows platform I end up with the following situation: /* demo.c is a simple application working with some tasks */ #include "os.h" /* os.h is needed as it has many required…
vl106
  • 11
  • 2
1
vote
3 answers

Is this a good practice of freeing dynamically allocated memory or it's not?

I wrote the following code sample: #include #include char *test(void); int main() { char *base_ptr = NULL; base_ptr = test(); for (char i = 0; i < 5; i++) { printf("base_ptr[%hhi] = %hhi\n", i,…
Sandrious
  • 118
  • 8
1
vote
3 answers

How are initialized local variables stored in the stack memory?

Does the storing of local variables into stack memory, depends on using their values in function calls? While doing some simple excercises with the "C" programming language and more specificly - with pointers, I've noticed the following anomaly (I…
Sandrious
  • 118
  • 8
1
vote
0 answers

Forcing an open file closed in (ANSI) C

I have a SCADA system (Siemens WinCC Classic 7.5) where there is data exchange between a storage facility and my system, based on text files. Sometimes (very rarely, maybe 1 in 2000) it crashes the connection to the network drives where the files…
mbk
  • 23
  • 3
1
vote
0 answers

Modify pointer-to-const variable (`const int*`) through a pointer to pointer-to-non-const (`int**`)

Let's consider the next code: #include int some_api_function_with_multiple_results( int** OUT_result ) { *OUT_result = malloc( 123 * sizeof(**OUT_result) ); return 42; } int main(void) { const int* numbers; /* don't ask me why…
1
vote
3 answers

How do I obtain a copy of the ANSI C standard?

Possible Duplicate: Where do I find the current C or C++ standard documents? I keep hearing about this 'ANSI C' standard, like it was some legal document my compiler somewhat conforms to, but I've never actually seen the document myself. Anywhere…
Sweetgirl17
  • 97
  • 1
  • 3
1
vote
1 answer

Carryless Mulitplicative Inverse - Calculation Error?

The following posting offers guidance on how to implment a carryless mulitplicative inverse. However, a simple implementation for 8-bit value pairs does not offer the expected results. static uint cl_mul(uint a, uint b) { uint r = 0; while…
1
vote
2 answers

How does ANSI C-Quoting in Herestrings work?

Why is this not working? bla=" multi line string " cat -A <
Booker B
  • 131
  • 2
  • 9
1
vote
0 answers

How to write a BSR (Bit Scan Reverse) in generic cross-platform ANSI C?

I need to find out how to do a Bit Scan Reverse (return the index of the highest set bit) for 8-bit, 16-bit, 32-bit and 64-bit integers in platform-independent ANSI C for use in an industrial process. I know about x86's _BitScanReverse, I can't use…
dave_thenerd
  • 448
  • 3
  • 10
1
vote
3 answers

order of two structures

I have these two structures... typedef struct{ MY_SECOND_STRUCT s1; }MY_FIRST_STRUCT; typedef struct{ int s1; }MY_SECOND_STRUCT; I prefer this order, I dont want to switch them. But compiler dont know MY_SECOND_STRUCT at the moment and I…
Meloun
  • 13,601
  • 17
  • 64
  • 93
1
vote
3 answers

Struct member corrupted after passed but not after passed again

I'm having some very strange bug in my ANSI C program. I'm using debugger and I've observed that 'size' variable is corrupted in function 'doSthing.' Outside of 'doSthing' 'size' got a proper value, but inside 'doSthing' I've got a value nothing…
imzs
  • 11
  • 3
1
vote
3 answers

Does ansi C place a limit on the number of external variables in a program?

By external variable I mean a variable declared with the extern modifier (and defined elsewhere in the program). I've been told of this limitation, and couldn't find a confirmation or rebuttal on the web. Is this true? If so, which is the limit? Is…
Emilio M Bumachar
  • 2,532
  • 3
  • 26
  • 30