Questions tagged as 'c'

1
answer

Compare strings in C exercise

I have the following exercise: Implement a function that is passed as input to two character strings. The function must return a 1 if the strings are equal, but it will return a 0 (it can not use specific functions of C). This is what I tr...
asked by 25.03.2017 / 00:14
4
answers

With which values are initialized the elements of a char type array

I have the following program: int main(){ char condominio[20][20]; return 0; } What values would each condominium element contain? Any special character? since when I print I do not see anything.     
asked by 07.12.2016 / 01:11
1
answer

C linux: Simulate shell behavior with pipes

As the title indicates I am trying to perform an exercise to emulate the behavior of the shell in the execution of a sentence with the form comando1 argumento1 | comando2 argumento2 This program opens a pipe and creates a child by callin...
asked by 28.06.2018 / 13:21
1
answer

Count ascending sequence

I have to do an exercise that receives numbers from the keyboard until I enter a 0 and show the number of ascending sequences (Example: 15, 9, 5, 3, 4, 6 has only 1 sequence). I did it like this: int i; int a[50]; int ascendente; printf ("Ingr...
asked by 16.07.2018 / 19:45
1
answer

where is the error? exchange of variables

Sorry but I'm new to c and I have to solve this exercise    Write the code of the program that requests the value of two integers and exchange them later, showing both the initial value of each variable and its final value. But when runni...
asked by 09.02.2017 / 04:47
1
answer

How to detect operating system with C preprocessor

I would like to do a program but there is a code that works only on Windows and another on GNU / Linux, I would like to know how I can use the preprocessor macros to do this, read something about it, that proposed this example : int main() {...
asked by 15.02.2017 / 23:36
1
answer

Create X11 Pixmap without window

To the function cairo_surface_t * cairo_xlib_surface_create (Display *dpy, Drawable drawable, Visual *visual, int width, int height); I need to provide you a Drawtable . I have no interest in the Drawtable being displayed, so...
asked by 10.05.2018 / 22:20
2
answers

Write doubles with fwrite in c

I'm going to ask a question maybe a newbie. I am using the fwrite function in C to write double data to a text file, but when I open the file I do not read numbers but a series of symbols and when I use binary files for writing o...
asked by 17.04.2018 / 00:56
1
answer

Write to file using hash function and cubes

I'm doing a function that reads a series of elements from a binary file and I have to pass them to another file that organizes them into cubes using the hash dispersion method. Here's the function: int creaHash(char *fichEntrada,char *fichHash...
asked by 23.05.2018 / 23:45
1
answer

Problem removing blanks at the end of a char type pointer *

I have a problem with this function. I'm trying to eliminate blank spaces at the end of a char * pointer. Something like this: char *ptr = "Soy un puntero dinámico y me sobran espacios al final "; With the difference that this is s...
asked by 12.06.2018 / 14:23