language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() int edad=20; int *pedad; int nueva_edad; pedad= &edad;//el puntero es igual a la memoria de edad osea 56789 en el ej printf("el valor del puntero es : %d ",*pedad); }
C
#include <stdio.h> #include <stdlib.h> typedef struct NodoLista{ int dato; struct NodoLista* sig; }NodoLista; NodoLista* crearNodo(); NodoLista* enlistar(); void eliminarElemento(NodoLista* ); void insertarElemento(NodoLista* ); void mostrar(NodoLista* ); void main(){ NodoLista* ini; int op; ini=enlistar(); ...
C
#include "stm32f4xx.h" unsigned short delay_c = 0; unsigned short blink_delay = 500; unsigned short light = 0x1000; void SysTick_Handler(void){ if(delay_c > 0) delay_c--; } void delay_ms(unsigned short delay_t){ delay_c = delay_t; while(delay_c){}; } void init(void){ SysTick_Config(SystemCoreClock/1000); RCC-...
C
#include <stdio.h> int main() { int n, v, p; scanf("%d", &n); scanf("%d", &v); if(v<0 || v>1) return 0; else scanf("%d", &p); if(p<0 || p>7) return 0; else { if(v == 1) { n = (1 << p) | n; } if(v == 0) { n = (~(1 << p)) & n; } } printf("\n %d \n", n); return 0; }
C
/* * SPMiniMax.c * * Created on: May 31, 2017 * Author: sapir */ #include "SPMiniMax.h" #include "SPFIARGame.h" #include "SPMiniMaxNode.h" #include <limits.h> #include <stddef.h> int spMinimaxSuggestMove(SPFiarGame* currentGame, unsigned int maxDepth) { if ((currentGame == NULL) || (maxDepth...
C
#include "my_put_string.h" size_t my_put_string(const char *string) { size_t charCount = 0; if (!string) return 0; while (*string++ != '\0') charCount += my_put_char(*(string - 1)); return charCount; }
C
#include <string.h> #include <kogata/malloc.h> #include <kogata/syscall.h> #include <kogata/debug.h> #include <kogata/region_alloc.h> int main(int argc, char **argv) { dbg_print("(BEGIN-USER-TEST malloc-test)\n"); dbg_print_region_info(); for (int iter = 0; iter < 4; iter++) { dbg_printf("Doing malloc test #%...
C
#include <stdio.h> int main() { int n, op = 1; float total = 0; scanf("%d",&n); for (int i = 1; i <= 2*n; i+=2){ if(op == 1){ total += 4.0/i; op = 0; } else{ total -= 4.0/i; op = 1; } } printf("%f...
C
#ifndef __BINARY_HEAP_STATIC_H__ #define __BINARY_HEAP_STATIC_H__ /******************************************************************************************************************* * typedef * *****************...
C
#include <stdlib.h> #include "point_array.h" /* ALL THESE FUNCTIONS REQUIRE A VALID POINT_ARRAY_T POINTER AS THEIR FIRST PARAMETER. THEY SHOULD FAIL ON ASSERTION IF THIS POINTER IS NULL */ // Safely initalize an empty array structure. void point_array_init( point_array_t* pa ) { if (pa != NULL) { pa->le...
C
/* Name GRfind_button_on_menu_bar Description This function will find a button on the menu bar which corresponds to the specified command string. If the menu bar to search is not specified by the caller, the routine will search for a displayed menu bar, stopping on the first on...
C
#include <stdio.h> void swap(double *a, double *b) { double buf = *a; *a = *b; *b = buf; } int main() { double a = 1.3; double b = 1.7; printf("ٲٱ a, b : %.1lf %.1lf\n", a, b); swap(&a, &b); printf("ٲ a, b : %.1lf %.1lf\n", a, b); }
C
// Vetor v = [20, 12, 28, 05, 10, 18] #include <stdio.h> #include <stdlib.h> void mostra_vetor(int v[], int n) { int i; printf("\n\nV ="); for (i = 0; i < n; i++) { if (i == n-1) printf(" %d.", v[i]); else printf(" %d,", v[i]); } } void troca(int *a, int *b) { int aux = *a; *a = *b; *b = aux; } ...
C
#include "holberton.h" #define USAGE ("Usage: cp file_from file_to\n") #define SOURCE (argv[1]) #define DEST (argv[2]) #define NO_READ ("Error: Can't read from file %s\n") #define NO_WRITE ("Error: Can't write to %s\n") #define NO_CLOSE ("Error: Can't close fd %d\n") /** * main - program that copies the content of a...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include"main.h" int main() { pStu pHead=NULL; pHead=create_node(); init(pHead); menu(pHead); return 0; } int menu(pStu pHead) { int function; while(1) { printf("-----------------\n"); printf("| 1、插入 |\n"); printf("| 2、删除 |\n"); printf("| 3、查找 |\n"); printf("| 4...
C
#include <stdio.h> int main () { float nota [4][3], media, av1, av2, av3; /*numero de linhas antes do de colunas*/ int i, j, mat; for (i=0; i<=3; i++) { for (j=0; j<=2; j++) { printf("\nEntre com a av%d do aluno %d:\n",j+1, i+1); scanf("%f", &nota[i][j]); } } printf("\nResultad...
C
/*! \file FileManager.c */ #ifdef __cplusplus extern "C" { #endif /************************************************************************* * I N C L U D E *************************************************************************/ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <uni...
C
// // Created by Luca Barco on 10/12/2017. // #include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include "atlList.h" #define MAXC 26 struct nodo_s{ atleta val; link_atleta next; link_piano head_piano; link_piano tail_piano; }; struct tabAtleti_s{ int nAtleti; link_at...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <stdbool.h> #include <errno.h> #include "note.h" #include "x_lib.h" int blank_note(struct statistics* stats, char* buffer, int offset, bool arg, int mask); int single_note(struct statistics* stats, char* buffer, int offset, bool a...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define SIZE 5 int again(int s[SIZE]){ int i; int k; for(i = 0; i < SIZE; i++){ for(k = i + 1; k < SIZE; k++){ if(s[i] == s[k]){ printf("틀린답 입니다.\n"); return 0; } } } printf("정답 입니다\n"); return 0; } int main(){ int i; int scores[SIZE];...
C
#include<stdio.h> void main() { int i,f[20],n[50],div[50],j,temp,quotient[20],z[10]; printf("enter the number\n"); for(i=0;i<6;i++) { scanf("%d",&n[i]); } printf("enter the polynomial\n"); for(i=0;i<4;i++) { scanf("%d",&div[i]); } for(i=8;i<12;i++) { n[i]=0; } for(i=0;i<8;i++) { temp=i; if(n[i]==1) { for (j=0;j<4;j++) ...
C
// // main.c // Chapter 10: Structs // // Created by Kathy Lin on 11/5/17. // Copyright © 2017 Kathy Lin. All rights reserved. // // typedef defines an alias for a type declaration and allows one to use it more like the usual data types. You can pass it to another function #include <stdio.h> #include <time.h> typ...
C
/* cc rbt_test.c rbt.c */ #include "rbt.h" #include <stdio.h> #include <string.h> int main() { RBT t = Initialize_rbt(); /* 10(B) / \ 5(B) 15(B) / \ / \ 13(R) 20(R) */ const int ITEM_1 = 10; t->...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> int main() { char buf[100]; int n; if((n=readlink("ep",buf,sizeof(buf)))==-1){ perror("readlink"); return -1; } buf[n]=0;//'\0' puts(buf); unlink("ep"); }
C
/* login : g.isaac@groupecerco.com */ #include <stdio.h> #include <stdlib.h> char *ft_strncpy(char *dest, char *src, unsigned int n); char *ft_strncpy(char *dest, char *src, unsigned int n) { unsigned int i; i = 0; while (i++ < n && src[i - 1]) dest[i - 1] = src[i - 1]; while (i++ < n) dest[i - 2]...
C
#pragma once #include <stdint.h> #include <stdbool.h> // Addresses here are already pre-shifted typedef enum { BMA400_I2C__0X28 = 0x28, BMA400_I2C__0X2A = 0x2A } bma400_i2c__address; typedef struct { int16_t x, y, z; } bma400_i2c__axes_raw_s; typedef struct { float x, y, z; } bma400_i2c__axes_mps2_s; /** ...
C
#ifndef __TREE_H__ #define __TREE_H__ #include <stdio.h> #include <stdlib.h> typedef void *Object; typedef struct node { Object value; struct node *left; struct node *right; } Node; typedef Node *Node_ptr; typedef struct { Node_ptr root; } Tree; typedef Tree *Tree_ptr; typedef enum { False, True } Bo...
C
#include<stdio.h> void main() { int i,n,result=0; printf("enter n value:\t"); scanf("%d",&n); for(i=0;i<=n;i++) { result=result+i; } printf("%d",result); }
C
#include<stdio.h> typedef long long ll; ll gcd(ll a, ll b) { while (b > 0) { ll t = b; b = a % b; a = t; } return a; } int main(){ ll N, cd; scanf("%ld", &N); scanf("%ld", &cd); for (ll i = 1; i < N; i++) { ll n; scanf("%ld", &n); cd = gcd(cd, n); } ll n = 1; ll cnt = 1; wh...
C
/*Problema 1: Comprobar a traves de un programa si un alumno aprobo o no un examen (Aprubea si su nota es mayor a 10.5) */ #include <stdio.h> int main(){ float examen; printf("Digite la nota del examen: "); scanf("%f", &examen); if( examen > 10.5){ printf("\nEl alumno esta aprobado"); // puts("El alumno ...
C
// htab_clear.c // Řešení IJC-DU2, příklad 2), 28.4 // Autor: Andrej Dzilský, FIT // Přeloženo: gcc 5.3.1 #include <stdlib.h> #include "libtable.h" void htab_clear(htab_t *t) { htab_listitem *item; /* cyklus v poli ukazatelov na zaznamy */ for (unsigned i = 0; i < t->htab_size; ++i) { /* nast...
C
// Author: Abs_; /* Problem: Given the values of three variables a, b and c, write a program to compute and display the value of x, where x = a /(b - c) , use the values (a) a = 250, b = 85, c= 25 (b) a = 300, b = 70, c = 70 Comment on the output in each case.*/ // **Note: a / 0 = NAN, so if b - c = 0 then the pro...
C
#include <stdio.h> int main (void) { int a; printf("Enter the number "); scanf("%d", &a); printf("Ur number %d\r\n", a); return 0; }
C
#include<stdio.h> #include<stdlib.h> #include<sys/types.h> #include<sys/socket.h> #include<netinet/in.h> #include<arpa/inet.h> #include<unistd.h> void main(int argc,char*argv[]) { int sid,sid1,rval,itr,i;// sid is half association. sid1 is full association struct sockaddr_in s,c; char buffer[20]; int clen; //accept...
C
/* * @lc app=leetcode.cn id=1518 lang=c * * [1518] 换酒问题 * * https://leetcode-cn.com/problems/water-bottles/description/ * * algorithms * Easy (69.17%) * Likes: 20 * Dislikes: 0 * Total Accepted: 9.9K * Total Submissions: 14.3K * Testcase Example: '9\n3' * * 小区便利店正在促销,用 numExchange 个...
C
#include<stdio.h> struct rankList{ int id; int M; int E; }; bool operator < (rankList a, rankList b){ if(a.M > b.M)return true; else if(a.M == b.M && a.E > b.E) return true; else return false; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); rankList rl;...
C
#include <stdio.h> /*ハブデータ * スポーク計算に必要なデータを記載 * 重量も記載している * 1、ハブの名称 * 2、PCD * 3、エンド幅(ロックナット間距離OLD) * 5、ロックナット-フランジ間距離(右) * 6、ロックナット-フランジ間距離(左) * 7、ハブ重量 * */ struct front_hub { char *name; double pcd; double old; double range; double weight; }; struct rear_hub { char *name; double pcd; double old;...
C
/**************************************************************************** * FreeRTOS data race example / JPP 22032017 * * ****************************************************************************/ #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include <stdio.h> /* FreeRTOS include fil...
C
#include "lists.h" #include <stdio.h> #include <stdlib.h> #include <stddef.h> /** * print_list - prints the string * in each node in the linked list * * @h: pointer to struct * * Return: count (success) 1 (fail) */ size_t print_list(const list_t *h) { /* set counter */ unsigned int count = 0; /* set HEAD t...
C
#include "base64.h" uint8_t base64Encode(uint8_t byte) { static uint8_t map[] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', 'w','x','y','z','0','1',...
C
/* Enumeraciones Una enumeracin (palabra reservada enum), es un conjunto de constantes de enumeracin enteras representadas por identificadores. Los valores de una enumeracin comienzan con 0, a menos que se especifique lo contrario, y se incrementan en 1. */ #include <stdio.h> //Las siguientes constantes de enumerac...
C
/** * @file lv_area.h * */ #ifndef LV_AREA_H #define LV_AREA_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #include <string.h> #include <stdbool.h> #include <stdint.h> #include "lv_mem.h" /********************* * DE...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <stdint.h> #define BLOCK_SIZE 512 typedef uint8_t byte; // typedef uint8_t byte; int checkSignature(FILE *diskImage, long *start); void copyBytes(FILE *output, FILE *diskImage, long *start, long offset); int main(int argc, char *argv[]) { // e...
C
/* * main.c * Copyleft (ɔ) 2021 greennewbie <adsl53102@gmail.com> * * Distributed under terms of the MIT license. */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <sys/wait.h> #define MIN_PID 300 #define MAX_PID 5000 #define NUM 10 pthread_mutex_t mutex;...
C
#include "holberton.h" #include <stdlib.h> /** * malloc_checked - function that adds 2 integers * @b: is one of the integers added together * * * Description: function allocates memory with malloc_check * Return: if malloc fails we use exit(98) */ void *malloc_checked(unsigned int b) { int *pointer; pointer...
C
#include <stdio.h> #include "variables.h" void GeneralRound ( i, f ) int i; void f ( int, int ); { int N, S, W, E; N = ( i - cx ) >= 0; S = ( i + cx ) < MatrixSize; W = i % cx; E = ( i + 1 ) % cx; if ( N ) f ( i - cx, i ); if ( S ) f ( i + cx, i ); if ( W ) f ( i - 1, i ); if ( E ) f ( i + 1, i ); if ( ...
C
#include <stdio.h> #include "stdtypes.h" typedef union { struct { uint_8 B0 : 1; uint_8 B1 : 1; uint_8 B2 : 1; uint_8 B3 : 1; uint_8 B4 : 1; uint_8 B5 : 1; uint_8 B6 : 1; uint_8 B7 : 1; } bits; uint_8 byte; } Register; int main(void) { ...
C
// Funcion Mosaico con SSE2+THREADS #include <stdio.h> #include <stdlib.h> #include <opencv/cv.h> #include <opencv/highgui.h> #include <emmintrin.h> // Aqui para SSE2 se define el tipo de dato __m128i y las funciones // _mm_load_si128 y _mm_store_si128 #include <time.h> #include <pthread.h> /* POSIX Threads */ #d...
C
#ifndef INC_DEBUGPRINT_H #define INC_DEBUGPRINT_H #define DEBUGPRINT_LVL_NONE 0 #define DEBUGPRINT_LVL_FEW 1 #define DEBUGPRINT_LVL_MANY 2 #define DEBUGPRINT_LVL_ALL 3 extern int global_debug_print_level; #ifdef DEBUG #define USE_DEBUG_PRINTING 1 #else #define USE_DEBUG_PRINTING 0 #endif #define deb...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct data { int num; struct data *next; } Data; Data *insert(int n, Data *start) { Data *new = malloc(sizeof(Data)); new->num = n; new->next = start; return new; } int ave(Data *start) { int ave = 0, total = 0; while (s...
C
// // Created by Sujay Bhowmick on 9/17/21. // #include <stdlib.h> #include <stdio.h> #include <string.h> #include "employee.h" Employee *createEmployee(char name[], unsigned char age) { Employee *e1 = (Employee *) malloc(sizeof(Employee)); strcpy(e1->name, name); e1->age = age; return e1; } void fre...
C
#include<stdio.h> #include<sys/types.h> #include<unistd.h> #include<errno.h> #include<fcntl.h> #include<string.h> #include<stdlib.h> #include<math.h> typedef struct {//super block utilization-1023 bytes unsigned int isize; unsigned int fsize; unsigned int nfree; unsigned int free[150]; unsigned int ninode; unsigned in...
C
#include "common.h" TCPSocket* tcpsock_setup(const char* host, int port){ TCPSocket* conn = calloc(sizeof(TCPSocket), 1); memcpy(conn->host, host, strlen(host)); conn->port = port; conn->sock = -1; conn->handle.sin_family = PF_INET; conn->handle.sin_addr.s_addr = inet_addr(host); conn->handle.sin_port = ...
C
//ͷļ #include "usually.h" #include "usart.h" //´,֧printf,Ҫѡuse MicroLIB #if 1 #pragma import(__use_no_semihosting) //׼Ҫֺ֧ struct __FILE { int handle; /* Whatever you require here. If the only file you are using is */ /* standard output using printf() for debugging,...
C
#include <stdio.h> typedef struct s { char c[9]; int i[10]; double d[10] } s_t; int main() { printf("size of struct is : %d \n", sizeof(s_t)); return 0; } // 9+7 + 40 + 80 = 136, but the real output is 132, very weird. hmm... // update: since the maximum padding is on the basis of highest size of bus size and ...
C
/* LTAGLT.C - Convert all voxels of specified value in a lattice to an ignore_tag. Author: Mike Wall Date: 5/5/95 Version: 1. */ #include<mwmask.h> int ltaglt(LAT3D *lat) { size_t i, j, k, r, index = 0; for(k = 0; k < lat->zvoxels; k++) { for(j = 0; j <...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* signal.c .:: .:/ . .:: ...
C
/* ** EPITECH PROJECT, 2020 ** matchstick ** File description: ** print map functions */ #include <unistd.h> #include "header.h" void print_map(char **map, int line, int game_status) { int x = 0; for (int y = 0; y != line + 2; y++) { for (; x != line * 2 + 1; x++) { my_putchar(map[y][x]);...
C
#include "logger.h" extern int errno; LOGGER_BOOL log_init(logger *l){ /*fname is ignored if mode is MODE_CONS or MODE_SYSLOG * priority cant be greater than 7 * log.priority=log.priority & 0x07 */ switch(l->mode){ case MODE_CONS: break; case MODE_SYSLOG: ...
C
#include <stdio.h> //int M, N; int K; typedef struct { int sx; int sy; int ex; int ey; }BUS; BUS bus[5000]; int chk[5000]; int sx, sy, ex, ey; typedef struct { int bus_n; int cnt; }QUEUE; QUEUE queue[5000]; int wp, rp; #define Enqueue(X) (queue[wp++] = (X)) #define Dequeue(X) ((X) = ...
C
int num(int m, int n) { if(m <= 1) return 1; if(n == 1) return 1; int sum = 0, i; for(i = 1; i <= n; i++) { if(i > m) break; sum += num(m - i, i); } return sum; } int main() { int n, i; scanf("%d", &n); for(i = 0; i < n; i++) { int M, N; scanf("%d%d", &M, &N); int r = num(M, N)...
C
#include "helpers.h" #include "math.h" #include "stdlib.h" #include "stdio.h" // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width]) { //accessing all the pixels for (int i = 0 ; i < height ; i++) { for (int j = 0; j < width; j++) { /...
C
/* ** vm_calc_instructions.c for src in /home/chapea_o/travail/corewar/git_corewar/corewar/vm/src ** ** Made by olivier chapeau ** Login <chapea_o@epitech.net> ** ** Started on Tue Dec 11 15:57:52 2012 olivier chapeau ** Last update Sun Dec 16 15:29:06 2012 olivier chapeau */ #include "vm.h" #include "vm_processe...
C
/* * File: FSM_Server.h * Author: Grupo1 * * Created on March 24, 2018 */ #ifndef FSM_SERVER_H #define FSM_SERVER_H /******************************************************************************* CONSTANT AND MACRO DEFINITIONS USING #DEFINE *********************************************************************...
C
#include <stdio.h> #include <string.h> #define ARRAY_LEN 4096 double x[ ARRAY_LEN ]; double y[ ARRAY_LEN ]; int main( int argc, char **argv ) { const double alpha = 2.1; for ( int i = 0; i < ARRAY_LEN; ++i ) { y[ i ] = 0.0; x[ i ] = 1.0; } #pragma omp simd for ( int i = 0; i < ARRAY_LEN; ++i ) { y[ i...
C
#ifndef JOYSTICK_H #define JOYSTICK_H // Button mappings #define BTN_INCSPEED 10 #define BTN_DECSPEED 13 #define BTN_TURNLEFT -1 #define BTN_TURNRIGHT -2 #define BTN_ASCEND 6 #define BTN_DESCEND 7 #define BTN_EMERGSTOP -3 #define BTN_ZEROSPEED 2 #define BTN_ARM_TORPEDO 1 #define BTN_ARM_MARKER 3 #define BTN_FI...
C
#include "linkedList.h" Node *head = NULL; void print_list(){ Node *list = head; while(list != NULL){ printf("%d\t", list->value); list= list->next; } printf("\n"); } void push(int value){ Node *list = (Node*) malloc(sizeof(Node)); list->value = value; list->next = head; head= list; } void insert_la...
C
#include <stdio.h> #include <stdlib.h> int main() { float average; int arr[50],source[50],sum=0,i,N; printf("Nhap so phan tu cho chuoi : "); scanf("%d",&N); for(i=0;i<N;i++) { printf("Nhap vao phan tu thu %d cho chuoi : ",i+1); scanf("%d",&arr[i]); } for(i=0;i<N;i++) { sum=sum+arr[i]; } average...
C
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> #include <ctype.h> #include "estructuraUno.h" #include "estructuraDos.h" #include "funcionesGenericas.h" #include "menu.h" #include "hardcode.h" #include "validaciones.h" int menuPrincipal() { int opcion; opcion = getI...
C
#include<stdio.h> int main() { float radius,area,*rad=&radius,*ar=&area; printf("Enter the radius of circle : "); scanf("%f",&radius); *ar=(22/7)**rad**rad; printf("\nArea = %f",*ar); return 0; }
C
/* ͷļ *****************************************************************/ #include "I2C.h" void I2C_GPIO_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; __HAL_RCC_GPIOA_CLK_ENABLE(); // RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); GPIO_InitStructure.Pull = GPIO_PULLUP; GPIO_InitStructure.Spe...
C
#include "validar.h" #include "cJSON.h" #include "mysql_connect.h" #define query_select_user "SELECT * FROM users WHERE username = '%s' AND password = '%s'" #define query_select_id "SELECT * FROM dispositivo WHERE id = %s" #define query_select_tipo_medicion \ "SELECT tm.id as...
C
#include "loli_core_types.h" #include "loli_generic_pool.h" #include "loli_symtab.h" #include "loli_type_maker.h" #include "loli_alloc.h" loli_generic_pool *loli_new_generic_pool(void) { loli_generic_pool *gp = loli_malloc(sizeof(*gp)); loli_class **cache_generics = loli_malloc(4 * sizeof(*cache_gener...
C
#include <stdlib.h> #include <stddef.h> #include <stdio.h> #include "lists.h" /** * delete_nodeint_at_index - function that ideletes the node * at index index of a listint_t linked list. * @head: listint_t pointer to a list node. * @index: the index of the node. * Return: a pointer to the indexed node. */ int delete_no...
C
#include "bricks.h" SDL_Rect** initialize_brick_array(SDL_Window* p_window, Uint16 nb_lines, Uint16 bricks_per_lines){ SDL_Rect** bricks_array = malloc(sizeof(SDL_Rect) * bricks_per_lines * nb_lines); // Define the offset between each bricks int offset = 10; // Get the screen size, in order to mana...
C
/* Input: 3 There is nothing permanent except change Output: There is nothing change except permanent Explanation: The last 3 words "permanent except change" are reversed and the remaining words are printed as it is */ #include<stdio.h> #include <stdlib.h> int main() { int n,i=0; scanf("%d\n",&n); char s[100][1001]; w...
C
#include <stdio.h> #include <stdlib.h> void Prekopiraj (const int *izvor, int *odrediste, int n){ int i=0; int* pomocni=odrediste; for (i=0; i<n; i++){ *odrediste=*izvor; izvor++; odrediste++; } odrediste=pomocni; } int main() { printf("Hello. \n"); ...
C
#include <stdio.h> #include <stdlib.h> #include <locale.h> int VerificarQuantidade(int refrigerante) { if(refrigerante == 0) { printf("\n Item esgotado! \n"); return refrigerante; } else return refrigerante; } int ReceberDinheiro(float precoRefrigerante) { float dinheiro; ...
C
/*#include "stdio.h" #include "stdlib.h" void GameResult(int a[]) { if (a[0]>=a[1]&&a[0]>=a[2]) { printf("B"); }else if(a[1]>=a[0]&&a[1]>=a[2]) { printf("C"); }else { printf("J"); } } void main() { int n; int i; char c; char d; int win[2]={0},lose[2]={0},pin[2]={0}; int a[3]={0}...
C
/* string_buffer.h project: string_buffer url: https://github.com/noporpoise/StringBuffer author: Isaac Turner <turner.isaac@gmail.com> Copyright (c) 2011, Isaac Turner All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the followi...
C
/* Author: Anthony Bustamante Date: 10Nov19 Description: Exercise 3-2 - Write a function escape(s,t) that converts charactgers like newline and tab intro visible escape sewquences like \n and \t as it copies the string t to s. Use a switch statement. Write a function for the other direction as well, converting...
C
int a[25]; int n; void main() { int i; int max(int); int num=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) num=max(i)>num?max(i):num; printf("%d",num); } int max(int chu) { int z=1,tempj; int i,j,k; if(chu==n-1) z=1; else{ for(j=chu+1...
C
// *** // *** You MUST modify this file. // *** #include <stdio.h> #include <stdbool.h> #include <string.h> #ifdef TEST_COUNTINT int countInt(char * filename) { // If fopen fails, return -1 FILE * fptr = fopen(filename,"r"); int sum = 0; if (fptr == NULL) { return -1; } else { // count the number...
C
#include <stdio.h> #include <stdlib.h> int main() { int peso; int contadorMax=0; int contadorMin=0; char seguir='s'; do { printf("Ingrese el peso del empleado: \n"); scanf("%d", &peso); if(peso<=80) { contadorMin++; }else { ...
C
/* * Write a function that takes 2 pointers and swaps the memory they point to. * The function should also take the size of each memory piece and should work * with any data type. */ #include <stdio.h> #include <stdlib.h> void swap(void *first, void *second, size_t size); int main(int argc, char** argv) { c...
C
/*Napisati funkciju koja e primiti cijeli broj vei od nule te odvojiti znamenke djeljive s 3 i one koje to nisu u dva odvojena broja. Primjer: broj 13597 treba pretvoriti u brojeve 157 i 39. Funkcija brojeve treba vratiti glavnom programu koji ih onda ispisuje.*/ #include <stdio.h> #include <math.h> void funk...
C
#include<lpc21xx.h> void delay(unsigned int); int main() { //basic gpio /* IODIR0 = 0x00005500; //0x0000FF00; //set direction as o/p using masking while(1) { IOSET0 = 0x00005500; //0x0000FF00; //reset delay(100); IOCLR0 = 0x00005500; //0x0000FF00; //set delay(100); } */ //odd evn gpio /...
C
#include "Level.h" _Tile *TileList=NULL; int TileListCount=0; _GlobalSectionEntry *GlobalSectionList=NULL; int GlobalSectionListSize=0; _SectionEntry *SectionList; int SectionListCount; int Level_BlockBaseHeight=64; int Level_BlockWidth=64; void Level_Init() { /* Create global section array */ /* Do this by loopin...
C
// Task: https://atcoder.jp/contests/abc114/tasks/abc114_b #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int i,j,ans=1000; float n; char s[20]; scanf("%s", s); for (i=0;i<8;i++) { for (j=n=0;j<3;j++) { n=n*10+s[i+j]-48; } ans=fmin(ans, fabs(753-n)); } printf("%d\...
C
#ifndef FOR_H #define FOR_H #include <stdio.h> struct Lesson { int position; char name[255]; }; struct Section { int position; char title[255]; int reset_lesson_position; int lessons_size; /* For now, every section will have at most 2 lessons, the count above is the actual number of lessons prese...
C
#include <stdio.h> int main(){ int i, sc=0, sd=0; float v[10], soma=0, psd; printf("Digite o saldo dos 10 clientes: "); for(i=0; i<10; i++){ scanf("%f", &v[i]); soma+=v[i]; if(v[i]>0){ sc++; } else{ sd++; } } psd = sd*10; printf("Saldo medio = %.2f\n", soma/10); printf("Porcentagem de clientes...
C
#include <stdio.h> main(){ int n, k; printf("Digite a quantidade de valores da lista: "); scanf("%d", &n); int array[n]; int *p = array; printf("\nLista:\n"); for(int i = 0; i<n; i++){ printf("Digite o valor %d: ", i+1); scanf("%d", (p+i)); } printf("\nDigite ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* load_scene_block.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> int main() { FILE * fp; int c; int i = 0; long pos; fp = fopen ("/dev/lprf", "r+"); printf ("Enter requested address (hex), 0 to cancel: "); scanf ("%X",&i); // while(i != 0) // { printf("fseek...\n"); fseek(fp, i, SEEK_SET); //calls kernel file_operations.llseek b...
C
#include "config.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #include <orc/orcprogram.h> #include <orc/orcdebug.h> /** * SECTION:orcexecutor * @title: OrcExecutor * @short_description: Running Orc programs */ #define CHUNK_SIZE 16 OrcExecutor * orc_executor_new (OrcProgram *program) { OrcE...
C
#include <stdio.h> int main(void) { int n; printf("Enter the n:"); scanf("%d", &n); for(int i = 1; i * i <= n; i++) { if(i * i % 2 == 0) printf("%d\n", i * i); } return 0; }
C
/** * https://www.spoj.pl/problems/LATTICE/ * Schier Michael */ #include <stdio.h> #include <math.h> #define MAXN 5000 // calculate the number of connections of length sqrt(w^2+h^2) in a n^2 grid long numConn(int n, int w, int h) { long result = (n-w) + (n-h) - 1; return w==h || w==0 || h==0 ? result*2 : result*...
C
#include<stdio.h> void main(){ int a,b,sum; a=214; b=1014; sum=a+b; printf("%d\n",sum); }
C
#include <stdio.h> int main() { int age = 0; float ageMinutes; printf("请输入您的年龄:"); scanf("%d", &age); ageMinutes = age * 3.156E7; printf("年龄对应的秒数为:%f\n", ageMinutes); printf("年龄对应的秒数为:%e\n", ageMinutes); return 0; }