language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#ifndef _SETUIDGID_H_ #define _SETUIDGID_H_ /* How should we treat supplementary groups? */ enum { SETUIDGID_SGROUP_IGNORE = 0, SETUIDGID_SGROUP_LEAVE_WARN, SETUIDGID_SGROUP_LEAVE_ERROR }; /** * setuidgid(user_group_string, leave_suppgrp): * Set the UID and/or GID to the names given in ${user_group_string}. If ...
C
#include <stdio.h> long long callRetInt(long long a); long long callRetPtr(long long a); long long callParaInt(long long a); long long callParaPtr(long long a); int main(__attribute__((unused)) int argc, __attribute__((unused)) char **argv) { long long fail = 0; long long a = 10; //printf("posit...
C
#include <stdio.h> int main(void) { int a1,a2; scanf("%d %d",&a1,&a2); a1=a1^a2; a2=a1^a2; a1=a1^a2; printf("%d %d",a1,a2); return 0; }
C
/* ** EPITECH PROJECT, 2018 ** PSU_42sh_2017 ** File description: ** Returns a char ** with the segmented path */ #include <stdlib.h> static int get_nb_seg(char *path) { int nb = 0; int i = 0; while (path && path[i]) { if (path[i] == ':') nb++; i++; } if (path && path[i] == '\0') nb++; return (nb); } ...
C
/* * kernel/driver/rtc.c * * MediOS project * Copyright (c) 2005 by Christophe THOMAS (oxygen77 at free.fr) * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * This software is distributed on an "AS IS" basis, WI...
C
/********************************************** Title: Toggle switch testing Ver: 1.0 Date: 2012-07-01 By: Aaron Hardware: XT-100 8x51 Develoment Board Connection: P0 -> LEDs (0:On 1:Off) P20 -> Switch S3 (0:On 1:Off) **********************************************/ #include <STC89.H> void delay(...
C
/********************************************************************************* * Copyright: (C) 2020 LuXiaoyang<920916829@qq.com> * All rights reserved. * * Filename: ComportOpen.c * Description: This file Open or close the serial port * * Version: 1...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* feg_print.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include "mystring.h" int main() { int i; String *s1 = make_string(); print_string(s1); /* char c = string_charAt(s1, 3); printf("%c\n", c); String *s2 = make_string(); int x = string_compare(s1, s2); printf("%d\n", x)...
C
#include <stdio.h> #include <assert.h> unsigned long add(unsigned long a, unsigned long b) { unsigned long result = 0; unsigned long k = 0x01UL; //the current bit which is under calculation int extra = 0; while(a || b) { if((a & 0x01UL) ^ (b & 0x01UL) ^ extra) result |= k; if(extra && !(a & 0x01UL) && !(b ...
C
// Copyright 2009, Andrew Corrigan, acorriga@gmu.edu // This code is from the AIAA-2009-4001 paper #ifndef COMPUTE_STEP_FACTOR_H #define COMPUTE_STEP_FACTOR_H #include <math.h> #include <cmath> #include "const.h" #include "inlined_funcs.h" inline void calculate_dt_kernel( const double* variable, const doub...
C
#include<stdio.h> #include<math.h> int main() { double a,b,c,d,e,f,g,h; while(scanf("%lf",&a)==1) { b=floor(a*log10(2)+1); c=exp((b-a)*log(2)+b*log(5)); printf("2^-%.0lf = %.3lfe-%.0lf\n",a,c,b); } return 0; }
C
#include <stdio.h> #include "bib.h" #define MAX 100 #include "bib.c" int main(int argc, char **argv){ int vetor[MAX] = {1,2,4,2,6,8,2,8,10,6}, tamanho = 10, indice; do{ indice = procura(vetor, tamanho); if(indice != -1){ removeDoIndice(vetor, &tamanho, indice); } }while(indice != -1); imprimir(vetor, ...
C
/********************************************************* * 実習5-6 * 時間を分で入力すると「〇時間〇分」に変換して返すプログラム * * 作成日 : 8/18.2020 * *******************************************************/ #include<stdio.h> int main() { char line[100]; int m_01, m_02, h; /*m_01は入力された分、m_02は剰余、hは時間を代入する変数*/ ...
C
#include "modulos.h" int **StHisto2DFF_d(int n, double *x, double *y, int nbinx, double *xmin, double *xmax, double yff) { double deltx; int i,jx,jy,ex,ey,**h; /* Creamos h */ h=matrix_i(nbinx,2); /* Inicializamos los valores de h a cero */ for(jx=0; jx<nbinx; jx++) { for(jy=0; jy<2; jy++) ...
C
/* * mm.c * In this approach, we used segrated lists and each list has blocks * of size class 2^n to 2^(n+1)-1. Free blocks are managed in this seg_list. * seg_listp is a global pointer to the first element of seg list. * The seg_lists is of size COUNT*WSIZE, each entry stores the address * of first block...
C
// Potenz zweier ganzer Zahlen (a hoch n) // Programm-Skelett zur Angabe // // Aufruf: power a n // // Klaus Kusche, 2010 #include <stdio.h> // Was steht in der Angabe zu atoi, was an dieser Stelle zu beachten ist? #include <stdlib.h> int main(int argc, const char *argv[]) { // hat der Aufrufer berhaupt zwei Zahl...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/socket.h> #include <sys/un.h> #include <errno.h> #include "logging.h" #define BUF_SIZE 512 #define RESPONSE_SIZE 32 #ifdef DEBON #define LOG_MSG(macrolevel, ...) \ debuglevel >= macrolevel ? logmsg(__FILE__, __FUNCTION__, __LINE__, 0, LOG_INFO...
C
// sum of squares of n numbers using for loop #include <stdio.h> int main() { int n, i, sum = 0; printf("enter the value of n\n"); scanf("%d", &n); for (i = 1; i <= n; i++) { sum = sum + i * i; } printf("the sum of squares of n numbers is %d", sum); }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { int a,b,*con,max=100,i,j; char **pal,**bus; scanf("%i",&a); pal=(char**)malloc(a*sizeof(char*)); for(i=0;i<a;i++){ pal[i]=(char*)malloc(max*sizeof(char)); } for(i=0;i<a;i++){ fflush(stdin); gets(pal[...
C
#include <stdlib.h> #include <string.h> #include "dictionary.h" static void _relocateMemory(struct Dictionary *instance, int newCountItems); struct Dictionary new_Dictionary() { struct Dictionary instance; instance.count = 0; instance.items = malloc(0); return instance; } void free_Dictionary(struc...
C
#include<stdio.h> #include<math.h> void getdata(float *a1,float *b1,float *c1) { printf("\nEnter the coefficient of x^2 :"); scanf("%f",a1); printf("Enter the coefficient of x :"); scanf("%f",b1); printf("Enter the constant :"); scanf("%f",c1); } void quad(float a,float b,float c,float *x,float *r1,float *r2) { ...
C
// // Created by A01229895 on 01/06/2019. // #ifndef CDS1LINKEDLIST_STACK_H #define CDS1LINKEDLIST_STACK_H // // Created by A01229895 on 28/05/2019. // #ifndef CDS1LINKEDLIST_LINKED_LIST_H #define CDS1LINKEDLIST_LINKED_LIST_H #include <stdbool.h> //to change type of data just change type of T typedef int T; typedef...
C
/** * c_io.c * * Based on Prof. Ooi Wei Tsang's solution from the CS1010 * I/O Library * * https://github.com/nus-cs1010-1819-s1/libcs1010 */ #include <ctype.h> #include <errno.h> #include <float.h> #include <limits.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "my_...
C
/* * leituraFrequencia.c * * Created: 04/04/2021 11:21:11 * Author : mateu */ #include <avr/io.h> int amostraPassadaCentradaEmZero = 0; uint8_t flagPassagemPorZero=0; int analog; float frequenciaCalculada = -1; int amostraCentradaEmZero = 0; static inline void configuracaoADC(){ /* O objetivo des...
C
//Write a program to convert centigrate to fahrenheit #include<stdio.h> int main() { float temp_f,temp_c; printf("Hello this is a temperature converter\n"); printf("Enter the centigrate temperature\n"); scanf("%f",&temp_c); temp_f = ((temp_c-32)*5)/9; printf("the converted temperature in fahrenheit is \n");...
C
/** * @project AwesomeProject * This is the description of AwesomeProject. * @file awesomeproject.c * This is the description of the source file for AwesomeProject. * @copyright (C)2100 Awesome Programmer * @contact awesome.programmer@example.com * @license BSD3 * @version 1.0 */ #include <stdio.h> /// @todo...
C
#include <stdio.h> #pragma warning(disable:4996) int main(){ FILE *file; file = fopen("/dev/random", "r"); int c; int i = 0; while ((c = fgetc(file)) != EOF && i < 20) { printf("%c ",(char)c ); i++; } printf("\n"); return 0; }
C
/* ** client.c -- a stream socket client demo */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <netdb.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <arpa/inet.h> #define TRUE 1 #define FALSE 0 #define ERROR -1 #defi...
C
/* * Copyright (c) 1980 Regents of the University of California. * All rights reserved. The Berkeley Software License Agreement * specifies the terms and conditions for redistribution. */ #ifdef FILEC /* * Tenex style file name recognition, .. and more. * History: * Author: Ken Greer, Sept. 1975, CMU. * Final...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <dirent.h> #include <errno.h> #include <string.h> #include <jansson.h> #include "data.h" #include "config.h" #include "verlet.h" #include "jsonUtils.h" int extractJsonObjectFromJsonObject(json_t * json, char * name, json_t ** field) { int rc = 0; ...
C
#include "lists.h" /** * add_dnodeint_end - adds a new node at the end * @head: head of the list * @n: value of the element * Return: the address of the new element * Aladin Bensassi */ dlistint_t *add_dnodeint_end(dlistint_t **head, const int n) { dlistint_t *h; dlistint_t *new; new = malloc(sizeof(dlistint_t)); if (n...
C
/*------------------------------------------------------------------------------ -- Source File: gps-utils.c -- -- Program: Wireless GPS Program -- -- Functions: -- int gps_search_sat (struct gps_data_t* gpsdata) -- -- Date: Nov 2 2017 -- -- Designer: Alfred Swinton -- -- Programmer: ...
C
#ifndef SERVICIOS_H_INCLUDED #define SERVICIOS_H_INCLUDED typedef struct { int id; char descripcion[20]; int precio; } eServicio; #endif // SERVICIO_H_INCLUDED int validarServicio(eServicio vec[],int tam,int idBusqueda); /** @brief recorre el vector vec[] y pregunta si hay al menos un dato con vec[].id =...
C
#include "purGLUtils.h" #include <limits.h> #define purGLAABBResetMin INT_MAX #define purGLAABBResetMax INT_MIN #define purGLAABBfResetMin FLT_MAX #define purGLAABBfResetMax (-FLT_MAX) const purGLAABB purGLAABBReset = {purGLAABBResetMin, purGLAABBResetMin, purGLAABBResetMax, purGLAABBResetMax}; const purGLAABBf pur...
C
#pragma once struct Coord { int X; int Y; Coord(int x = 0, int y = 0) : X(x), Y(y) {} };
C
/** * Copyright (C) EEMBC(R). All Rights Reserved * * All EEMBC Benchmark Software are products of EEMBC and are provided under the * terms of the EEMBC Benchmark License Agreements. The EEMBC Benchmark Software * are proprietary intellectual properties of EEMBC and its Members and is * protected under all applic...
C
#include <stdio.h> #include <stdlib.h> #include "Grafo.h" int main(void){ Grafo *gr = cria_grafo(5, 5, 0); //Busca em profundidade int eh_digrafo = 1; insere_aresta(gr, 0, 1, eh_digrafo, 0); insere_aresta(gr, 1, 2, eh_digrafo, 0); insere_aresta(gr, 1, 3, eh_digrafo, 0); insere_aresta(gr, 2, 4, eh_digrafo, 0)...
C
/* Title: consonants.c Description: This program takes command line arguments as input and prints out all the consonants in the input. Author: Omar Abdelrahman */ #include <stdio.h> #include <string.h> // Main function int main(int argc, char *argv[]){ // Declaring variables int i=0; char consonant...
C
/** ****************************************************************************** * @file : bootloader.c * @brief : Functions related to bootloader * ---------------------------------------------------------------------------- * @author : Sebastian Popa * @date : Dec, 2...
C
#include <stdio.h> int main() { int a; int* ptrtoa; ptrtoa = &a; a = 5; printf("The value of a is %d\n", a); *ptrtoa = 6; printf("The value of a is %d\n", a); printf("The value of ptrtoa is %d\n", ptrtoa); printf("It stores the value %d\n", *ptrtoa); printf("The address of ...
C
/** * @file slider.h * */ #ifndef GUI_SLIDER_H #define GUI_SLIDER_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "RTE_Include.h" #if GUI_USE_SLIDER != 0 /*Testing of dependencies*/ #if GUI_USE_BAR == 0 #error "slider: bar is required. Enable it ...
C
#include<stdio.h> // PARIDADE // AULA 01 EXERCICIO 01 int par(int num){ if(num%2==0){ num=1; } else{ num=0; } return num; } int main(){ int n; printf("introduza o numero:\n"); scanf("%d",&n); if(par(n)==0){ printf("%d e' impar.\n",n); } else{ printf("%d e' par.\n",n); } return 0; }
C
/* ============================================================================ Name : PrimerParcialProgra.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ Dada una es...
C
#include <stdio.h> #include <stdlib.h> // MANUAL POLYMORPHISM WITH C typedef struct iRenderer { void(*Render)(int x, int y); void(*Dispose)(); }iRenderer; typedef struct iInput { void(*GetKey)(struct iInput *self,int x); void(*Dispose)(struct iInput *self); }iInput; void SDL_Input_GetKey(iInput *self...
C
/* ** EPITECH PROJECT, 2018 ** my_putstr ** File description: ** 1 */ #include "my_pushswap.h" void my_putstr(char *str) { int a; a = 0; while (str[a] != '\0'){ my_putchar(str[a]); a++; } }
C
#include "philo.h" static void init_data(t_philo *philo, char **argv, char argc) { philo->data.nbr_p = ft_atoi(argv[1]); philo->data.time_to_die = ft_atoi(argv[2]); philo->data.time_to_eat = ft_atoi(argv[3]); philo->data.time_to_sleep = ft_atoi(argv[4]); philo->data.nbr_time_eat = 0; if (argc == 6) philo->data...
C
#include <stdio.h> #include <stdlib.h> int main(int argc,char *argv[]){ char mpoint[256]; int check=-1; strcpy(mpoint,"/mnt/tmp/mpoint_"); strcat(mpoint,argv[1]); check=setuid(0); if(check<0) perror("Setuid Error "); check=execl("/bin/umount","umount",mpoint,NULL); if(check<0) perror("Umount Error ")...
C
int smallest_number(int *array[], int size);
C
#include <math.h> #include <stdio.h> int main(int argc, char** argv) { int num_test_cases; scanf("%d", &num_test_cases); for(int i = 0; i < num_test_cases; i++) { int n; scanf("%d", &n); int pow = 5; int addend = 0; int res = 0; while((addend = n / pow) > 0) { res += addend; pow *= 5; } pri...
C
/******************************************************************** * * File: ics9db1200.c * Name: * * Description: * Clock Buffer ICS chip lib * * * Copyright (c) 1985-2009 by Cisco Systems, Inc. * All rights reserved. * * ******************************************************...
C
/* * * matrix.c * Tim Green * 3/20/14 * version 1.0 * * Project 3, Part 1 - Matrix Multiplication * */ #define M 3 #define K 2 #define N 3 #include <stdio.h> #include <stdlib.h> #include <pthread.h> void *CalcProduct(void *param); typedef struct v { int i; int j; } Element; // A[COLS] == B[ROWS] int ...
C
/* * Soubor: proj2.c * Datum: 20.11.2014 * Autor: Adam Bezak - 1BIA - xbezak01@stud.fit.vutbr.cz * Projekt: Iteracne vypocty * Popis: Implementujte vypocet vzdalenosti a vysky mereneho objektu pomoci udaju ze senzoru * natoceni mericiho pristroje. Vypocet provedte pouze pomoci matematickych operaci +,-,*...
C
//640p 6 #include <stdio.h> #define SET_BIT(n,pos) ( n |= (0x01 << pos) )// SET Ʈ ũ #define CLR_BIT(n,pos) ( n &= (~0x01 << pos) )// CLR Ʈ ũ #define GET_BIT(n,pos) ( (n >> pos) & 0x01 )// GET Ʈ ũ void main(void) { int n; printf("Enter n "); scanf_s("%d", &n);// Ʈ Է printf("SET_BIT : %d \n", SET_BIT...
C
#include <stdio.h> #include <stdlib.h> main() { incre(); incre(); incre(); } incre() { static char var =65; printf("\n The character stored in var is %c ",var++); }
C
#ifndef _VECTOR_H #define _VECTOR_H #include <assert.h> #include <stdlib.h> #define STRUCT_BODY(type) \ struct { \ size_t size : 54, on_heap : 1, capacity : 6, flag1 : 1, flag2 : 1, \ ...
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<fcntl.h> #include<sys/stat.h> int main(int argc,char *argv[]){ if(argc!=2){ printf("usage:access<pathname>"); } if(access(argv[1],R_OK)<0){ printf("access error for %s\n",argv[1]); } else printf("read access OK\n"); if(open(argv[1],O_RDONLY)<...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { FILE *file = fopen(argv[1], "r"); if (file == NULL) { printf("empty file"); return 0; } unsigned short x; fscanf(file, "%d", &x); printf("%d", x); unsigned short n, v; char action[5]; while (fsc...
C
#include "ficheros.h" /* 1.Pasarlo como argumento escribiéndolo en consola y utilizar la función strlen() para calcular su longitud 2.Pasarlo como argumento haciendo el cat de cualquier fichero, por ejemplo un fichero.c de vuestra práctica de la siguiente manera: “$(cat dir_practica/fichero.c)” 3.Asignarlo a un buffe...
C
#ifndef MAIN_H #define MAIN_H /* begin standard C header files */ #include <stdlib.h> #include <stdarg.h> #include <unistd.h> #include <limits.h> #include <stdio.h> /* macros */ #define BUFSIZE 1024 #define TRUE (1 == 1) #define FALSE !TRUE #define LOWHEX 0 #define UPHEX 1 /* structs */ /** * struct inventory_s - ...
C
#include <stdio.h> #include <stdlib.h> #define MAXN 100//Ʒ int w[MAXN],V[MAXN]; int C;// int n;//Ʒ int d[MAXN][MAXN]; int jMax; int min(int,int); //֮Сֵ int max(int,int); //ֵ֮ void print_ans(int d[][MAXN],int,int); //ŽⲢ int main() { int i,j; printf("Ʒn(1-100):\n"); scanf("%d",&n); printf("ÿ\n"); ...
C
/************************************************************** Problem: 1337 User: jhyunlee Language: C++ Result: Success Time:1 ms Memory:1092 kb ****************************************************************/ #include<stdio.h> #include<malloc.h> int main() { int N; int map[100...
C
#include"fct_aux.h" /* ensures retourne 1 si la case selectionnee est valide 0 sinon */ int is_valid_indice(char str[4], int n) { int tmp; char *buftmp; if (str[0]<'a' || str[0]>'a'+n-1) return 0; buftmp = str; /* on utilise buftmp pour ne pas modifier str */ buftmp++; tmp = (int) strtol(buftmp, NULL, 10...
C
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be use...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* draw.c :+: :+: :+: ...
C
/* Include file for grid.c - for more details see there */ /* Written by I.J.Bush March 2011 - if it breaks your computer or aught else, tough. */ /* The grid and associated data. Note we will need two versions of the data on the grid, one to hold the current values, and one to write the results into when we are...
C
Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not. (Hint: Use the % (modulus) operator) #include<stdio.h> int main() { int year; printf("enter year\n"); scanf("%d",&year); if(year%400==0...
C
#include <stdio.h> void print_matrix_spiral(int arr[3][6], int max_row, int max_col) { int row=0, col=0; int i; while(row <= max_row && col <= max_col) { for (i = col; i <= max_col; i++) printf("%d,",arr[row][i]); printf("\n"); row++; for (i = row; i <= max_row; i++) printf("%d,",arr[i][max_col]); p...
C
/* PL/0' 用 LL(1)再帰下降型構文解析器 No.03 * 2015年後期 鹿児島高専 * 3年生 言語処理系 授業用 * * 構文解析/意味解析を行っている * * ループを使わず再帰のみでやっている * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../lexer/tokentable.h" #include "symbol_table.h" #include "misc.h" extern FILE *yyin; /* 読み込むソース...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "data_inout.h" #define N 1 /* ソート関数 */ int int_sort( const void * a , const void * b ) { /* 引数はvoid*型と規定されているのでint型にcastする */ if( *( int * )a < *( int * )b ) { return -1; } else if( *( int * )a == *( int * )b ) { return 0; } return...
C
#include <stdio.h> unsigned int mystery(unsigned int a , unsigned int b); int main() { unsigned int x; unsigned int y; scanf("%u%u",&x,&y); printf("%d",mystery(x,y)); } unsigned int mystery(unsigned int a , unsigned int b){ if(b==0){ return 0; } else{ return a + mystery(a...
C
#include<stdio.h> #include<math.h> int main() { float N; scanf("%f",&N); N=fabs(N); printf("%.2f",N); return 0; }
C
#include<stdio.h> #include<stdlib.h> #include<signal.h> void dis(int sig) { static int i=0; sleep(2); printf("Sig is %d\n",i++); } int main() { sigset_t s1,s2; struct sigaction act1; char buf[100]; int ret; sigemptyset(&s1); sigaddset(&s1,SIGINT); act1.sa_handler=dis; sigfillset(&act1.sa_mask); act1.sa_f...
C
#include "libft.h" void *ft_memmove(void *dst, const void *src, size_t len) { unsigned const char *s; unsigned char *d; size_t i; s = src; d = dst; i = 0; if (len == 0 || d == s) return (d); while (d <= s && len > i) { d[i] = s[i]; i++; } while (d > s && len > 0) { d[len - 1] = s[len - 1]; l...
C
#include<stdio.h> int main() { int i, n;/*={10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200};*/ printf("Enter the number of array: "); scanf("%d",&n); int a[n]; printf("Please enter the value in serial order in the array:\n"); for(i=0;i<n;i++) { s...
C
#ifndef SNAKE_H #define SNAKE_H #define MAXCASES 12 #define MAXSNAKE 5000 #include <stdio.h> #include <stdlib.h> #include <time.h> #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_mixer.h> #include <SDL2/SDL_ttf.h> /* Type booléen */ typedef enum _bool {FALSE, TRUE} bool; /* Type codant l'état d...
C
#include "reweight_layer.h" #include "cuda.h" #include "blas.h" #include <stdio.h> reweight_layer make_reweight_layer(int batch, int n, int *input_layers, int *input_sizes, ACTIVATION activation) { fprintf(stderr,"reweight "); reweight_layer l = {0}; l.type = REWEIGHT; l.batch = batch; l.n = n; ...
C
#include <stdio.h> #include "cipherUtils.h" //These global variables are inherently private to the current file FILE *rFile = NULL, *wFile = NULL; // rFile = file being read from, wFile = file being written to char *string = NULL; // current string that is divided into blocks int stringSize = 0; // current string ful...
C
#include "Portfolio.h" Portfolio *newPortfolio() { Portfolio *temp; temp=malloc(sizeof(Portfolio)); return temp; } void setBankAccount(Portfolio *ptfolio, double cash) { ptfolio->bankAccount=cash; } void initializePortfolio(Portfolio *port, CAsset *assets) { int i; Asset *currentAsset;...
C
#include <stdio.h> enum directions { UPRIGHT = 1, UPLEFT, DOWNLEFT, DOWNRIGHT }; void tile(int, int, int, int, int); int main(void) { int l, m; scanf("%d%d", &l, &m); tile(l, m, UPRIGHT, l / 2, l / 2); return 0; } void tile(int l, int m, int direction, int x, int y) { if (l == m) { retur...
C
#include <stdio.h> #include <stdlib.h> struct Node{ int data; struct Node *next; }; struct Node *headNode=NULL; void insert(int num){ struct Node *temp=(struct Node*)malloc(sizeof(struct Node)); temp->data=num; temp->next=NULL; if(headNode==NULL){ ...
C
unsigned int fib(unsigned int param0) { unsigned int result = param0; if((int)param0 > 1) { unsigned int v0 = 1; unsigned int v1 = 1; if((int)param0 > 2) { unsigned int v2 = param0 - 2; do { unsigned int v3 = v0; v0 += v1; ...
C
#include <stdio.h> #include <math.h> #include <stdint.h> uint32_t primes[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211...
C
#include <stdio.h> #include <sorted_list.h> /*private functions*/ static int IsIntBefore(const void *element_data, const void *user_data, void *param); static int CompareInt(const void *list_data, const void *user_data); void TestFlow1(); void TestFlow2(); void TestFlow3(); void TestFlow4(); ...
C
#include <stdio.h> #include <stdlib.h> int main(void){ char* buf; buf = malloc(1LL << 60); fgets(buf,1024,stdin); printf("buf = %s\n",buf); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> main() { int i, j; double a, max, min; min = 32000.0; max = -32000.0; for (i = 1; i <= 50; i++) { a = cos (2 * 3.14 * i / 50 + 3.14 / 2) / sin (2 * 3.14 * i / 50 + 3.14 / 2); if (a < min) min = a; else if (a > max) max = a; f...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <stdlib.h> #include <stdio.h> #include "disassembler.h" int main(int argc, char const *argv[]) { FILE *f = fopen(argv[1], "rb"); if (f == NULL) { printf("Error - couldn't open %s\n", argv[1]); exit(1); } fseek(f, 0L, SEEK_END); int fsize = ftell(f); fseek(f, 0L, SE...
C
#include <stdio.h> #include <stdlib.h> #include <stdio_ext.h> #include "funciones.h" int utn_getNumeroMio(int* pResultado,char *mensaje,char *mensajeError,int minimo,int maximo,int reintentos) { int ret; int num; while (reintentos>0) { printf("%s",mensaje); if (getInt(&num)==0) ...
C
// Copyright 2016 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #pragma once #include <magenta/processargs.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif // The mx_tls_root_t describes the object point...
C
#include<stdio.h> int main() { int num,remainder,result=0; printf("enter a number:"); scanf("%d",&num); num=number; while(number!=0) { remainder=number%10; result=remainder*remainder*remainder; number/=10; } if(result==num) printf("%d is an armstrong number:"); return(0); } }
C
/***************************************************************************** * * File: delays.c * * Copyright S. Brennen Ball, 2006-2007 * * The author provides no guarantees, warantees, or promises, implied or * otherwise. By using this software you agree to indemnify the author * of any damages incurred...
C
/* *strings.c */ #include<stdio.h> #include<stdlib.h> #include<string.h> #include"strings.h" #include"errorhandler.h" string String(char *s) { string p = checked_malloc(strlen(s) + 1); strcpy(p,s); return p; } void *checked_malloc(int len) { void *p = malloc(len); if(!p) { fprintf(stde...
C
#include<stdio.h> int num_list[10]= {2,5,7,9,3,1,0,6,4,8}; void selection_sort(); int main(){ int iswitch = 1;/*odering switch, 0:ascendeing, 1:descending*/ int i; selection_sort(iswitch); for(i=0;i<10;i++){ printf("%d",num_list[i]); } printf("\n"); } void selection_sort(int mode...
C
#ifndef _DS_TRIE_H #define _DS_TRIE_H #include <stdbool.h> // The trie only accepts lower 26 characters, 'a' - 'z'. struct Trie; struct Trie* createTrie(); void destroyTrie(struct Trie* trie); bool trieAddWord(struct Trie* trie, const char* s); struct Trie* trieGetSubTrie(struct Trie* trie, char c); struct Trie* ...
C
#include <stdio.h> //program:复制字符串 //date:2018.05.23 int main(int argc, char *argv[]) { char *p = "123 456 789"; char buff[20] = {0}; int sum = 0; __asm__ __volatile__ ( "mov r0, %1 \n" "mov r3, %2 \n" "mov r1, #0 \n" "loop: \n" "ldr r2, [r0] \n" "ldr r4, [r3] \n" "cmp r2, #0 \n" "strne r2, [r3] \n...
C
int findx(int **ball,int N, int *arr) { int i,j=0,a=0; int x; while (a < N) { i = 0; j = 0; while (j < N) { x = ball[0][a] - ball[1][j]; for (i = 0; i < N; i++) { if (ball[1][j] - ball[2][i] == x) { /* temp = ball[2][0]; ball[2][0] = ball[2][i]; ball[2][i] = temp; ...
C
#include <log.h> #include <statedef.h> #include <script.h> #include <sprite.h> #include <level.h> #include <gameglobal.h> #include <physics.h> #include <string.h> #include <object.h> #include <camera.h> //Object type names const char object_typename_table[OBJECT_TYPES][MAXSTR] = { "unknown", "player", "enemy", ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <sys/stat.h> #include "varsFile.h" #define TRUE 1 #define FALSE 0 char **retValueListPtr; int retValueListCnt; int retValueListAllocated = FALSE; void freeValueList() { int i; if (retValueListAllocated) { for...
C
#include <stdio.h> #include <stdlib.h> #include "heap.h" void heapSort(Heap **heap) { int i, n = (*heap)->size, tmp; for(i = (n - 2) / 2; i >= 0; i--) { descer(heap, i); } for(i = n - 1; i > 0; i--) { tmp = (*heap)->h[0]; (*heap)->h[0] = (*heap)->h[i]; (*heap)->h[i] = tmp; (*heap)->size -= 1; descer(h...