Questions tagged [c]

Ask Question

C is a general-purpose programming language used for system programming (OS and embedded), libraries, games and cross-platform. This tag should be used with general questions concerning the C language, as defined in the ISO 9899 standard (the latest version, 9899:2018, unless otherwise specified — also tag version-specific requests with c89, c99, c11, etc). C is distinct from C++ and it should not be combined with the C++ tag absent a rational reason.

381,080 questions 2
0 votes 0 answers 3 views

What are the differences between sem and pthread_cond in C

Hello I start with pthread_cond and semaphore in C and I see semaphore have this services: int sem_init(sem_t *sem, int shared, int valini); int sem_destroy(sem_t *sem); int sem_wait(sem_t *sem); int ... user avatar Michael
  • 1
-2 votes 0 answers 22 views

Is there any Equivalent to this c code in assembly language x86

Is there any Equivalent to this C Code in the Assembly language x86? Probably, Yes but I don't know. Here's the C Code #define lol 0x00004000 #define something 0x00000100 void main(void) { ... user avatar DBYTES
  • 13
2 votes 0 answers 17 views

Suppressing "variable set but not used" warnings in the disabled case of a debug printf macro

There are a ton of questions about suppressing "variable set but not used" warnings, but I haven't found one that addresses my very specific problem, which is a debugging macro defined as ... user avatar zwol
  • 129k
0 votes 0 answers 19 views

Linked List nodes disappear while adding (nodes showing garbage values)

I need to read a set of data from a text file and add them as nodes to a linked list. The linked list needs to be an ordered list according to studentID present in the data. I did the following code. ... user avatar lushaka nisansala
  • 1
0 votes 0 answers 16 views

How to code function if nothing, or wrong input is entered to ask aqain for input + what is wrong. It is possible everything split in functions?

#include <stdlib.h> #include <stdio.h> char input(char emailInput[100]) { printf("Enter email:"); // if nothing or wrong email is input repeat// gets(... user avatar Ivan Geljić
  • 1
1 vote 1 answer 39 views

Recursive function for converting lower case to upper case

I've been tasked to write a recursive function in C that changes a string of any chars to all caps (without using toupper() or any other function for that matter). This is the previous code and ... user avatar Peace and Love
  • 11
0 votes 1 answer 28 views

When to use calloc or malloc in C [duplicate]

What's better/more efficient - calloc or malloc? I want to initialise structs, that refer to other instances of the same struct also VARIANT 1 person *new_person() { struct _person *person = ... user avatar Petra Enis
  • 101
2 votes 3 answers 24 views

using C copy a 1D char array into 2D char array

I am trying to copy a 1D array of Strings into a 2D array of strings in C. I was able to achieve this with integer enter image description here //Here is what I tried for integers. int main() ... user avatar Moodkiller
  • 31
-4 votes 0 answers 20 views

What will be the output of a fork() in a for loop

int main() { pid_t pid; int i; printf("START\n"); for (i=0; i<6; i++){ if ((pid = fork()) <0){fprintf(stderr, "Fork failed\n"); return 1;} printf("A\n"); ... user avatar ChecksOverStripes
  • 1
0 votes 0 answers 15 views

NOOB Q - # include <stdio.h) in VScode [duplicate]

Recently started learning to code and for my very first program in C I am Getting this error and don't know how to fix it: cannot open source file "stdio.h" code : #include <stdio.h> ... user avatar Soul
  • 1
1 vote 4 answers 40 views

Why are asterisks needed for array variable?

Looking at the code segment down below, array in C language is already a pointer saving the address of the first element of the array, so why the asterisk is needed for argv variable? char *argv[3]; ... user avatar Aries Zhao
  • 11
0 votes 0 answers 16 views

Calling C function from Kotlin using JNI

I have created two C functions with the following declarations: /* Function Declarations */ extern void compute_feature_set(double input[1102], double F_data[], int ... user avatar FerasAS
  • 261
1 vote 1 answer 60 views

C memory leak, where there is no memory leak? (valgrind)

valgrind is telling me that a specific line in my code creates a memory leak, but when looking at that line, it does not seem to even be able to create one. I am working with this pretty simple Linked ... user avatar Toast
  • 31
-4 votes 0 answers 29 views

why the return has no output of counting function in C? [closed]

I need to create a function that return the number of characters given . but there is no output. (ps: i cant use printf for study issues) #include <stdio.h> int ft_strlen(char *str) { int i =... user avatar MOAD TELLAMI
  • 1
0 votes 2 answers 30 views

function that returns a version of the given arrays where each zero value in the array is replaced by the smallest odd value to the right of 0. In C

I'm having a bit of trouble with this problem. The full text of the problem is as follows : "Write a function that returns a version of the given array of non-negative integers where each zero ... user avatar emcosokic
  • 3

15 30 50 per page1234525406

You Might Also Like