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
1 answer

Portable plain C function for extracting filename from path

I am looking for a portable way to extract the filename from a path string in ANSI C. The paths are like the following…
Jesko
  • 85
  • 11
1
vote
2 answers

Missing header file, for ANSI C?

I hope you're doing well. I was going through the book, "Compiler Design In C", by Allen I. Holub, when I came across these header files implemented in a sample program: #include #include /* Needed only for prototype My…
Saif Ul Islam
  • 345
  • 3
  • 14
1
vote
2 answers

Which shell will execute the cmd when popen is called

First of all, forgive my awful english..... This is the prototype FILE *popen(const char* cmd_string, const char* type); Here is my question, the book says that when popen function is called, it will call exec to get a shell to execute the…
anonymous
  • 61
  • 7
1
vote
1 answer

Segfault 11 on long string, PRIOR to accessing string, only when string > 14

ANSI c on OSX 10.13.6 Apple LLVM version 9.1.0 (clang-902.0.39.2) Target: x86_64-apple-darwin17.7.0 Thread model: posix I'm learning c This is a function that manually (character-by-character) adds two character strings representing large numbers…
RightmireM
  • 2,381
  • 2
  • 24
  • 42
1
vote
0 answers

Passing array to function changes function 'sizeof(array)'

EDIT: I believe this question is different from How do I determine the size of my array in C?, because that link discusses how to use sizeof(nlist)) / sizeof(nlist[0]) to determine the number of items in an array. My question is asking why that…
RightmireM
  • 2,381
  • 2
  • 24
  • 42
1
vote
1 answer

Implementing a 64bit integer using 32bit integers

I am implementing an opcua server from specification. Opcua encodes datetime as a 64bit signed integer. The server will run on a 32bit embedded system that doesn't include(support) standard 64bit integers. I've tried looking online but i can't see…
salimsaid
  • 3,186
  • 4
  • 15
  • 20
1
vote
2 answers

Get maximum and minimum from numbers

I need to print maximum and minimum number from numbers. Problem is that when i set mn and mx to 0 it just wont work because when user write numbers 1 2 3 4 5 minimum is 0 and not 1 and thats the problem. My code: #define…
user9817924
1
vote
1 answer

Mingw-w64 C versions support?

What versions of C does minigw-w64 support? It uses msvcrt.dll so wouldn't it only support ANSI C? But then i see programs like VLC use it but say that they require C11. How is this possible? EDIT: Some sources: How to printf a size_t without…
Cyburg3
  • 19
  • 3
1
vote
1 answer

C pointer to function with unspecifiable signature

I intend to explain a standard proof of recursion theorem in C, by using factorial as an example. So I have #include typedef unsigned Nat; typedef Nat Func(); Nat G(Nat n, Func f){ if(n) return n * f(n-1, f); else return…
Veky
  • 2,646
  • 1
  • 21
  • 30
1
vote
1 answer

ANSI C -> Arrays -> Variably modified at file scope

While I'm trying to explore possibilities of arrays in C in ANSI, I'm confronted with an issue. Here's my code: #include #include static int MAXLIGNE = 5000; char *ptrlig[MAXLIGNE]; // Ptr sur la ligne de txt // Got an issue: …
1
vote
2 answers

ANSI C quotes getting added to my code in bash

I am writing a script to build a CSV file to import to our LMS. One of the script's function does an ldapsearch for the user's guid. The command looks as such: ldapsearch -x -h ldap.example.com -b ou=person,dc=example,dc=com user=username On its…
Kemo
  • 23
  • 3
1
vote
1 answer

All functions and structs raise "implicit declaration of " errors/warnings when used in main.c

Errors that have been raised: ; main.c:18:12: warning: implicit declaration of function ‘get_word’ [-Wimplicit-function-declaration] word = get_word( &sentence ); main.c:18:12: warning: implicit declaration of function ‘get_word’…
Mitch
  • 25
  • 3
1
vote
1 answer

C90 - initializing arrays in global and in function scope

I want to know the properties of initializing array once in global scope and once in the function scope. Let say: char arr[4]; int main() { ..... } What will be the values in this array? What with this option: int main() { char arr[4]; …
babushka
  • 45
  • 4
1
vote
1 answer

Client implementation using the OPC Foundation ANSI C Stack

Can anyone help me out to implement the OPC UA client implementation using the OPC Foundation ANSI C Stack. I believe that only the server implementation is available in the repository, so far. I have the OPC UA server working using the OPC…
TechDev
  • 41
  • 2
  • 4
1
vote
1 answer

What does it mean in C : #define ABC(a,b) {#a, a, b}

What does it mean in C : #define ABC(a,b) {#a, a, b} ? I understand that ABC is a Macro with parameters (a,b). But what does it mean {#a, a, b} and especially what does mean "#a" in such case?
Sunkat
  • 393
  • 1
  • 3
  • 8