Questions tagged as 'c'

2
answers

Problem when declaring a string to a variable in a C structure

I am doing some C test programs to learn a little more about the language, the program I am doing now is to show the grades of some students: #include <stdio.h> #include <stdlib.h> #include <time.h> struct alumno{ char na...
asked by 08.10.2018 / 00:40
2
answers

Make a program that reads a matrix and adds its elements

My brother was sent to do the exercise mentioned in the title, he did it but he does not get the sum, but only returns the entered data; #include<stdio.h> #define MAXFIL 20 #define MAXCOL 30 void leermatriz( int a[][MAXCOL], int nfilas...
asked by 06.10.2018 / 08:16
2
answers

How to return a matrix in C?

My problem is a matrix declared in a function as I do to have the values of the matrix in a second function that prints it, something like this: #include<stdio.h> #include<conio.h> #include<time.h> void main(){ int m,n; print...
asked by 04.07.2018 / 02:06
1
answer

Iterate an array of characters in c

I want to print each element of the array but it generates a segmentation fault This is the code: #include <stdio.h> int main(){ char arreglo[3]={'c','f','d'}; char *puntero; puntero=arreglo; for(int i=0;i<3;i++){...
asked by 14.06.2018 / 23:11
3
answers

reassign value to string

I have this assignment to a string: unsigned char cadena[] = {154,162,162,145,'unsigned char cadena[] = {154,162,162,145,'%pre%'}; '}; What is "hola" , but in decimal. How can I reassign another decimal value to the same variable c...
asked by 11.06.2018 / 20:24
1
answer

Doubt about INADDR_ANY

I am working on a project in which I want to communicate a computer with a Raspberry Pi using the UDP communication protocol. My doubt comes at the time of declaring the IP address. I have read on some pages that this applies to all local interf...
asked by 27.05.2018 / 02:59
1
answer

C - Vector (Find the position of the minimum of Vector 1 - Show on screen the even and odd numbers of Vector1)

I need 1. Show the odd and even numbers of the Vector1 on the screen 2. Show on screen the minimum number of vector 1, and in what position of the vector is each number. For example: The minimum number is -3 which is in position 3 I'm...
asked by 28.04.2018 / 05:38
2
answers

problem with infinite loop

I need to do a program that asks for the sex and age of a number of people (it is supposed to end by putting 'n' in sex) ... and then says how many women and men attended ... in addition to intervals of age (how many men and women of certain age...
asked by 20.05.2018 / 22:42
2
answers

Save better punctuation in a game

I have to save the best score obtained from a game made in C in a file: the functions I can use are fopen , fclose , fprintf , fscanf . I tried to do it like this: int puntos=0;;; if (lo que sea) { puntos=puntos+1; } F...
asked by 10.04.2018 / 22:40
1
answer

File reading with variable length

I have a file with variable length (lines of variable length) and it has blank spaces. I want to read line by line to process it, but I can not detect the end of line. I read the file with this instruction: while (fscanf(fp,"%[^while (fscan...
asked by 07.04.2018 / 05:35