language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <string.h> #include <ctype.h> #include "mcc.h" /* string buffer / number parse buffer */ #define MAX_BUFFER 256 typedef struct ident { struct ident *next; char *id; } IDENT; static IDENT *s_ident_top = NULL; char* new_ident(const char *s) { IDENT *p = (IDENT*) alloc(sizeof (IDENT)); p->id ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_sort_list.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* colorize.c :+: :+: :+: ...
C
/* Date: 4/1/2017 Description: ģstarskipListʵ֣ʵԼskipList ӵݽṹ 1. һж(Level); 2. ĵһе; 3. ÿһ㶼һ; 4. Ԫxڵi㣬бiСIJ㶼Ӧðx; 5. iͨһdownָָһӵֵͬԪ; 6. ÿһУ-11Ԫض(ֱʾINT_MININT_MAX); 7. TOPָָ߲ĵһԪء Author: VitoYang */ #pragma once //ϵskipList汾Ϊ򵥣ʺѧϰ #include <random> #include <ctime> #include <cstdl...
C
#include "memory_access.h" memory_read32_t memory_read32; memory_read16_t memory_read16; memory_read8_t memory_read8; memory_write32_t memory_write32; memory_write16_t memory_write16; memory_write8_t memory_write8; #include "../common/utils.h" int memory_bound(int offset, bound_t* bound) { if (bound) { int e...
C
#include <stdio.h> #include <stdlib.h> void lerNomes (char *arquivoEntrada, char *palavra) { printf("Informe o nome do arquivo de entrada: "); setbuf(stdin, NULL); scanf("%s", arquivoEntrada); printf("Informe uma palavra: "); setbuf(stdin, NULL); scanf("%s", palavra); } int main () { FILE *arq; cha...
C
#ifndef VM_PAGE_H #define VM_PAGE_H /* Supplemental page table. * * Contains additional information about each page contained in the * page table (defined in userprog/pagedir.h). */ #include <hash.h> #include "filesys/file.h" #include "vm/swap.h" /* Possible values for where to read and write data. */ enum spt_p...
C
//Objective: A program to simulate the Bankers Algorithm for Deadlock Avoidance. #include<stdio.h> #include<conio.h> void main() { int n,r,i,j,k,p,u=0,s=0,m; int block[10],run[10],active[10],newreq[10]; int max[10][10],resalloc[10][10],resreq[10][10]; int totalloc[10],totext[10],simalloc[10]; clrscr(); printf("Enter...
C
#include<stdio.h> #include<string.h> int main() { char b[] = "Hello"; char* a = "Boy"; char* c = "Hello"; b[0] = 'b'; // this is ok // a[0] = 'b'; // this isn't, unsized string's // index based operations not allowed printf("a : %s\n", a); printf("b : %s\n", b); printf("c : %s\n", c); printf("\nSi...
C
#include <stdio.h> #include <regex.h> #include <string.h> #define LARAALNUM "^[a-z0-9A-Z_ ]*$" int main (int argc, char* argv[]) { char input[100 + 1], regExpStr[100 + 1]; input[0] = '\0'; regExpStr[0] = '\0'; int ind = 0,retVal = 0, regExpFlag = 0, inputFlag = 0; regex_t re; while (ind < argc) { ...
C
// // Created by max on 19/11/2020. // #include "client1.h" int iResult; struct Animal currentAnimal; struct Player currentPlayer; SOCKET ConnectSocket = INVALID_SOCKET; const char *get_clientAddress_4(struct addrinfo *sa) { struct sockaddr_in *pV4Addr = (struct sockaddr_in *) &ConnectSocket; struct in_addr...
C
// This piece of code reads a print a character,string and a line #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { char character; char string[100]; char sentence[100]; scanf("%c",&character); scanf("%s",&string); scanf("\n"); ...
C
#include <stdio.h> void ft_putchar(char c); void ft_print_alphabet(void); void ft_putchar(char c) { write(1, &c, 1); } void ft_print_alphabet(void) { int i; i=97; while(i < 123) { ft_putchar(i); i++; } ft_putchar('\n'); } int main(void) { ft_print_alphabet(); ...
C
/*------------------------------------------------------------------*- TLight_A.C (v1.00) ------------------------------------------------------------------ Traffic light control program Simplex version - has no information about bulb status on other node. COPYRIGHT ---------...
C
// tokenizer.c // Naeem Hossain // nh302 // September 29, 2016 // Computer Architecture #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> // A decimal integer constant token is a digit (1-9) followed by any number of digits. // An octal integer constant token is a 0 followed by an...
C
#include <stdio.h> using namespace std; int main() { int ingresar,cuadrado; scanf("%d",&ingresar); while(ingresar!=0){ cuadrado=ingresar*ingresar; printf("El cuadrado del numero %d es: %d\n",ingresar, cuadrado); scanf("%d",&ingresar); } }
C
/* prgccpc.c */ /* machine dependent code for delorie's GCC for PC 386's (a DOS extender) */ #include <stdio.h> #include <ctype.h> #include "prtypes.h" #define CANTALLOCATE "cant allocate " #define CRPLEASE "Carriage return please" #define NOCONFIGFILE "sprolog.inf missing using default configuration" #define...
C
#include <stdio.h> #include <stdlib.h> #define ROW_SIZE 16 #define COL_SIZE 16 #define BOOM_DIVIDE_BY_N 10 #define CELL_BOMB -1 #define CELL_EMPTY 0 #define CALL_FUNC_FOR_NEAR_CELLS( FUNC, COL, ROW ) \ FUNC ( COL , ROW + 1 ); \ FUNC ( COL , ROW - 1 ); \ FUNC ( COL + 1, ROW ); \ FUNC ( COL - 1, ROW ...
C
#include<stdio.h> #include<string.h> int xorr(int a,int b) //xor operation { if(a==b) return 0; else return 1; } int andd(int a, int b) //and operation { if(a==1 && b==1) return 1; else return 0; } int...
C
#include "drb.h" typedef struct singleLinkListNode { int data; struct singleLinkListNode *link; } snode; typedef struct doublyLinkListNode { int data; struct doublyLinkListNode *prev_link; struct doublyLinkListNode *next_link; } dnode; int continueProgramPrompt(char message[]) { int choice = ...
C
//Find whether a given matrix is symmetric or not. #include<stdio.h> int main(){ int n,m; printf("Anurag Chowdhury\n"); printf("Enter no. of rows\n"); int a[10][10]; scanf("%d",&n); printf("Enter no. of columns\n"); scanf("%d",&m); printf("Enter Matrix\n"); for(int i=0;i<n;i++){ ...
C
#include "libft.h" int ft_atoi(const char *str) { unsigned int i; int j; long k; i = 0; j = 1; k = 0; while ((str[i] >= 9 && str[i] <= 13) || str[i] == 32) i++; if (str[i] == '-' || str[i] == '+') { if (str[i] == '-') j *= -1; i++; } while (str[i] >= '0' && str[i] <= '9') { k = k * 10 + st...
C
#include <stdio.h> #include <stdlib.h> #include <stdio.h> #include <locale.h> int razao(int *n1, int *n2){ if (*n1 % *n2 == 0) return 1; else return 0; } int main(void){ setlocale(LC_ALL,"Portuguese"); int V1 = 0, V2 = 0; int result; printf("Entre com o valor 1: "); scanf("%d", &V1); printf("Entre com o...
C
#include <stdio.h> /** * main - prints the sum of all the multiples of 3 or 5 below 1024. * Return: 0 Sucesfull. */ int main(void) { int i, suma; suma = 0; for (i = 3; i < 1024; i++) { if (i % 3 == 0 || i % 5 == 0) suma = suma + i; } printf("%d", suma); printf("\n"); return (0); }
C
#include "lista.h" #include <stdlib.h> #include <stdio.h> void sllPrint(sll * l, void (*print)(void*)){ node * aux; /*Itera por cada elemento aplicando a função print passada*/ if(l->first!=NULL){ aux = l->first; while(aux!=NULL){ print(aux->data); print...
C
#include "types.h" #include "user.h" #include "stat.h" #include "xv_user.h" #include "xv_color.h" #include "xv_variable.h" int main(int argc, char *argv[]) { struct variable variables[V_MAX]; int v_num = 0; int i = 1; int setfore = 0; //mark whether there is optional arg int setback = 0; //mark whether ther...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include "data_structure.h" void life_destroy(p_life_t life) { if(life == NULL) { return; } if(life ->children != NULL) { free(life -> children); life -> children = NULL; } if(life ->money != NULL) { free(life -> money); life -> money = NULL; ...
C
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debu...
C
#include<stdio.h> #include<conio.h> int main() { int A[10],temp=0,i,j; clrscr(); printf("Enter the elements of the array: "); for(i=0;i<10;i++) scanf("%d",&A[i]); for(i=0;i<10;i++) for(j=i+1;j<10;j++) if(A[i]<A[j]) { temp=A[i]; A[i]=A[j]; A[j]=temp; } printf("The Array in...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> int main() { int num = 0, i, n,*arr; printf("Ԫظ\n"); scanf("%d", &n); printf("飺\n"); arr = (int*)malloc(sizeof(int) * n); for (i = 0;i < n;i++) { scanf("%d", &arr[i]); } for (i = 0;i < n;i++) { num ^= arr[i]; } printf("%d\n",num); ret...
C
#include<stdio.h> #define DENSITY 1.23 #define MAX_VELOCITY 40 #define VELOCITY_STEP 5 void menu(double *coef, double *area); double drag_force(double *coef, double *area, int velocity); int main(){ double coef, area, force; menu(&coef, &area); for (int velocity = 0;velocity <= MAX_VELOCITY;velocity += VELOCITY_S...
C
#include <stdio.h> #include <conio.h> int main() { FILE *character; char ch; character = fopen("d:/data/character.txt","w"); printf("a data file is opened for you,\nwrite something\npress Ctrl+Z at the end\n"); while ((ch=getchar()) != EOF){ putc(ch,character); } fclose(ch...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int **transpose(int **matrix, int m, int n){ int** arr; arr = (int**)malloc(n * sizeof(int*)); for(int i = 0; i < n; i++){ arr[i] = (int*)malloc(m * sizeof(int)); } for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ arr[j][i] = matrix[i][j]; ...
C
#include <stdio.h> int your_grade(int n); //prototype of your_grade function /////////////////////////////////////////////////////////////////////////// ////This program shows the grade which matches with scores you entered///// /////////////////////////////////////////////////////////////////////////// int main(voi...
C
// // main.c // Lista de Structs // // Created by João Victor Ipirajá de Alencar on 13/05/19. // Copyright © 2019 Jipiraja. All rights reserved. //Questão //2. Implemente um programa que leia o nome, a idade e o enderec ̧o de uma pessoa e armazene os dados em uma estrutura. #include <stdio.h> #include<String.h> #...
C
/** @author Levente Kurusa <levex@linux.com> **/ #include "../include/pic.h" #include "../include/display.h" #include "../include/hal.h" #include <stdint.h> MODULE("PIC"); void pic_init() { /* We have to remap the IRQs to be able to process * hardware-related interrupt requests and to service * exceptions as wel...
C
#include <stdio.h> main() { int x=1; int y=2; int max; max = x>y? x:y; // if x>y true, max =x, else max = y }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define SIZE 1000 void split_words(char * [], const char [], int); void display(char * const[], int); void free_mem(char * [], int); void get_line(char [], int); int main(void) { int n_words; char ** words; char * pc; char temp[SIZE]; print...
C
/* This test program draws some bitmaps from an SD card. */ #include <io.h> #include <system.h> #include <sys/alt_stdio.h> #include <string.h> #include <sdcard_ops.h> #include <graphics_commands.h> #include <efsl/efs.h> #include <efsl/ls.h> #include <altera_avalon_sgdma.h> #include <altera_avalon_sgdma_descriptor....
C
#include "unit_test_util.h" //SUPPORTING MACROS ASSERT_TRUE/ASSERT_FALSE etc.. #include "../SPLogger.h" #include <stdbool.h> #include <stdio.h> #include <stdlib.h> // This is a helper function which checks if two files are identical static bool identicalFiles(const char* fname1, const char* fname2) { FILE *fp1, *fp2...
C
#include<stdio.h> int main() { int numero, i; scanf("%d",&numero); for(i=1;i<=numero;i++) { if(i%2==0) { printf("%d^2 = %d\n", i,(i*i)); } } }
C
#include<stdio.h> #include<sys/wait.h> #include<unistd.h> #include<stdlib.h> int call(int i,int j) { int pid=0; if(j==0) { return 0; } pid=fork(); if(pid==0) { printf("\niam level %d | pid : %d|ppid: %d",i-j,getpid(),getppid()); call(i,i-1); exit(0); } else{ wait(NULL); } ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* tools.c :+: :+: :+: ...
C
void ft_putchar(char c); void ft_print_comb2(void) { int i = 0; int j = 0; int k = 0; int l = 0; while (i <= 9) { j = 0; while (j <= 8) { k = i; while (k <= 9) { if (i == k) l = j + 1; else l = 0; while (l <= 9) { ft_putchar(i+'0'); ft_putchar(j...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> void noichuoi(char *a,char *b){ strcat(a,b); puts(a); } int main () { system("cls"); char a[100],b[100]; printf("Nhap a: "); gets(a); printf("Nhap b: "); gets(b); printf("\nOUTPUT:\n"); noichuoi(a,b); printf("\n"); system("paus...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* lex_rt.c :+: :+: :+: ...
C
struct matrix *readGraph(char *filename) { FILE *fp = fopen(filename, "r"); int src; int dest; GRAPH_SIZE = 0; fscanf(fp, "%d", &GRAPH_SIZE); // printf("Gs: %d\n", GRAPH_SIZE); struct matrix *am = m_fill(GRAPH_SIZE, GRAPH_SIZE, 0); while (fscanf(fp, "%d %d", &src, &dest) != EOF) { ...
C
#include <stdio.h> #include <stdlib.h> int main() { printf("!SIMPLTRON!\n"); const int maxArraySize=100; int memory [maxArraySize]; int instructionRegister=0, battery=0; int adressRegister=0; int registerOperation=0; printf("Enter, your code: \n"); do { int userCode; ...
C
#include "func.h" #include <math.h> #include <string.h> #include <stdio.h> #include <stdlib.h> //Лейбниц float Pi(int K){ int coef = 1; float pi = 0; for(int i = 0; i < K; i++){ pi += (pow(-1, (i + 2))) / coef; coef += 2; } pi *= 4; return pi; } //двоичная char* translation(lon...
C
#include <stdio.h> #include <string.h> #include <windows.h> #include <math.h> double dev(int * nums,int n); int main(){ int n,k,i,j,l; int * num; int * arr; double min; scanf("%d %d",&n,&k); num=(int*)malloc(sizeof(int)*n); for(i=0; i<n; i++){ scanf("%d",&num[i]); } for(i=k; i<=n; i++){ arr=(int*)malloc(...
C
#include"Header.h" void Prime(int *ptr,int iSize) { int iCnt=0,iValue=0; for(iValue=0;iValue<iSize;iValue++) { for(iCnt=2;iCnt<*ptr;iCnt++) { if((*ptr%iCnt)==0) { break; } } if(*ptr==iCnt) { printf("%d prime no \t",*ptr); } ptr++; } }
C
/* * inst.c */ #include "inst.h" clock_type *clock_head = NULL; void start_clock(char *aName) { clock_type *p; for(p = clock_head; p!=NULL; p=p->next) if( StrEqual(p->name, aName) ) break; if( p == NULL ){ p = (clock_type *) emalloc (sizeof(struct clock_node)); p->name = estrdup(aName); p->ticks = 0...
C
#include<stdio.h> int main() { string arr[] = {"geeksforgeeks", "geeks", "geek", "geezer"}; int n = sizeof(arr) / sizeof(arr[0]); string ans = commonPrefix(arr, n); if (ans.length()) printf ("The longest common prefix is - %s", ans.c_str()); else ...
C
/* ** EPITECH PROJECT, 2020 ** PSU_42sh_2019 ** File description: ** print.c */ #include <stdio.h> #include <string.h> #include "input.h" void print_buffer(pos_t *t) { dprintf(1, "\x1b[%d;%dH", t->c.y, 1); dprintf(1, "\x1b[?25l"); dprintf(1, "\x1b[K"); dprintf(1, "%s", t->buffer[t->ind]); dprintf(1...
C
#include <stdio.h> int hammingWeight(int); int main(void) { int n =11; printf("%d\n", hammingWeight(n)); return 0; } int hammingWeight(int n) { int counter = 0; for (; n; counter++) n &= (n - 1); return counter; }
C
#ifndef F_CPU #define F_CPU 1600000UL // CPU Frequency #endif #include <avr/io.h> #include <stdio.h> #include <stdlib.h> #include <avr/pgmspace.h> #include <avr/interrupt.h> #include <util/delay.h> #include "nrf24/nrf24.h" #include "sonar/sonar.h" static uint8_t tx_address[5] = { 0x0, 0x0, 0x0, 0x18, 0x0 }; stat...
C
/* FUNCTION <<wcsxfrm_l>>---locale-specific wide-character string transformation INDEX wcsxfrm_l SYNOPSIS #include <wchar.h> int wcsxfrm_l(wchar_t *__restrict <[stra]>, const wchar_t *__restrict <[strb]>, size_t <[n]>, locale_t <[locale]>); DESCRIPTION <<wcsxfrm_l>> transforms the wide-characte...
C
/* * 多幂序列.c * * Created on: 2017年6月29日 * Author: lfsenior */ #include <stdio.h> void c333() { int k, m, t, p2, p3, p5; double a, b, c, s, f[100]; printf(" 求数列的第m项与前m项和,请输入m: "); scanf("%d", &m); f[1] = 1; p2 = 0; p3 = 0; p5 = 0; a = 2; b = 3; c = 5; s = 1; for (k = 2; k <= m; k++) { if (a < ...
C
#define _CRT_SECURE_NO_WARNINGS #include "task2.h" #include<stdio.h> #include<stdlib.h> #include<ctype.h> #include<string.h> #define CHECK_OK 0 #define CHECK_FALL 1 #define GARBAGE '\0' //selection is made for string typedef long int LI; #define MAX_LENGHT_STRING 255 #define POINTER_FALL 0 int searchTre...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> #include "restart.h" #include <errno.h> int main(int argc, char *argv[]) { pid_t childpid; int i, n; if (argc != 2) { fprintf(stderr, "Usage: %s n\n", argv[0]); return 1; } n = atoi(argv[1]); for (i = 1; i < n; i++) if ((childpid ...
C
/** * @file myfind.c * * SS-2018 - BES * * Beispiel 1 - myfind * * @author Roland Varga <ic17b073@technikum-wien.at> * @author Leonhard Meisel <ic17b033@technikum-wien.at> * @author Fritz Schülein <ic16b081@technikum-wien.at> * @author Mahboobeh sadat Shafiee <ic17b074@technikum-wien.at> * @date ...
C
/** * _strlen - provides string length. * @s: The string in question. * * Return: length of string. */ int _strlen(char *s) { unsigned int i; i = 0; while (s[i] != '\0') i++; return (i); }
C
#ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif /* Scrivere un programma C, completo delle opportune dichiarazioni di variabili,in grado di acquisire in ingresso dall'utente un valore intero positivo num. Il programma deve stampare a video tutti i fattori primi di num */ #include <stdio.h> // inclusione lib...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #ifndef FILEREADER #define FILEREADER FILE *fr; int test() { int n; long elapsed_seconds; //ESSID is van de vorm LAADPAALXXX => 11 karakters char line[80],ESSID[12]; char ** netwerken = (char**)malloc(sizeof(char*)*0); int aantal_netwerken =...
C
#include <stdio.h> #include <stdlib.h> int max ( int a, int b ) { return (a >= b ? a : b);} int min ( int a, int b ) { return (a <= b ? a : b);} void display(int numRows, int numCols, int p[][30] ) { int i,j; for (i = 0; i< numRows;i++) { for ( j = 0;j< numCols;j++) { ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* record_sprite.c :+: :+: :+: ...
C
//////////////////////////////////////////////////////////////////////////////// // Filename: proc_table.h // Authors: David Oh, Minseok Gang // Email: doh24@wisc.edu, gang3@wisc.edu // CS login: doh@best-linux.cs.wisc.edu, minseok@best-linux.cs.wisc.edu // Date: 12/05/2020 /////////////////////////////////////////////...
C
/* Disable warning for scanf unsafe ONLY for visual studio */ /*#pragma warning(disable : 4996) #pragma warning(disable : 6031)*/ #include <stdio.h> #include <stdlib.h> #include <math.h> #define SIZE 100 typedef enum { FALSE, TRUE }BOOLEAN; // **************** Implementation of Stack for the operato...
C
#include "../CommonGI/Definitions.h" #include "../Randoms/RandomX.h" static uint4 rng_state; uint TausStep(uint z, int S1, int S2, int S3, uint M) { uint b = (((z << S1) ^ z) >> S2); return ((z & M) << S3) ^ b; } uint LCGStep(uint z, uint A, uint C) { return A * z + C; } float HybridTaus() { rng_state.x = TausSt...
C
// client_functions.c // contains the common functions of the client.c file #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> // prints the error message that is passed as an ...
C
/* ** File: vesa.c ** ** Author: Sean Congden ** ** Description: VESA support routines */ #define __KERNEL__20113__ #include "types.h" #include "lib/klib.h" #include "c_io.h" #include "bios.h" #include "vesa.h" //#define TRACE_VESA #ifdef TRACE_VESA # define TRACE(...) c_printf(__VA_ARGS__) #else # define TRACE(.....
C
#include <unistd.h> #include <sys/types.h> #include <errno.h> #include <stdio.h> #include <sys/wait.h> #include <stdlib.h> #define PROCS 3 #define LEVELS 2 void sig_handler(int signum) { printf("Received signal %d\n", signum); exit(signum); } int spawn_procs(int level) { pid_t childpid[PROCS]; int i = 0; if(lev...
C
#include<stdio.h> #include<stdbool.h> #include <math.h> #include "NumClass.h" int powe(int a,int b){ int power=1; while(b!=0){ power*=a; b--; }return power; } int isArmstrong(int x){ int count=0; int n=x; int v=x; int sum=0; while(x!=0){ count++; x=x/10; } while(n!=0){ sum+=(powe((n%10),count)); n=...
C
#ifndef JOS_MACHINE_ATOMIC64_H #define JOS_MACHINE_ATOMIC64_H #include <machine/param.h> #define ATOMIC_LOCK JOS_ATOMIC_LOCK typedef struct { volatile uint64_t counter; } jos_atomic64_t; static __inline__ void jos_atomic_set64(jos_atomic64_t *v, uint64_t i) { v->counter = i; } static __inline__ void jos_atomic...
C
#include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <string.h> #define MAXLINE 80 //80 char per command input #define BufferSize 50 char history[10][BufferSize];//history array to store history commands int count = 0; /** *this main(void) will read in command line and sepa...
C
#include <stdio.h> #include <string.h> #define TRUE 1 #define FALSE 0 int endsWith(const char* text, const char* tail) { int text_len = strlen(text); int tail_len = strlen(tail); if (tail_len > text_len) return 0; return (strcmp(text+text_len-tail_len, tail) == 0); } void test(const char* text, con...
C
/**************************************************************************** Darren Yau CSE 12, W20 1/27/2020 ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_itoa.c :+: :+: :+: ...
C
/************************************************************************* > File Name: p3.c > Author: > Mail: > Created Time: Wed 11 Dec 2019 11:38:26 AM UTC ************************************************************************/ #include<stdio.h> #define DAY_WEEK 7 int main(void) { int total_days, week...
C
//һɾظԪأʹÿԪֻһΡ //ʾ1 : //: 1->1->2 // : 1->2 //ʾ2 : // : 1->1->2->3->3 // : 1->2->3 #include"leetCode.h" typedef struct ListNode listNode; struct ListNode* deleteDuplicates(struct ListNode* head) { if (!head || !head->next) return head; int temp = head->val; listNode* cur = head->next, * pre = head; while (cur) { ...
C
/* * UTN_calculos.c * * Created on: 16 abr. 2021 * Author: micay */ #ifndef UTN_CALCULOS_C_ #define UTN_CALCULOS_C_ #include <stdio.h> #include <stdlib.h> int Sumar(int a, int b, int *punteroSuma) { int retorno; int suma ; retorno = 0; if (punteroSuma != NULL) { suma = a + b; *punteroSuma = sum...
C
/* 3.13 Determinar cuanto les costara el pasaje considerando que las tarifas del autobus son si son mas de 100 alumnos el costo es de $20 si son entre 50 y 100, $35. Entre 20 y 49,$40. si son menos de20 alumnos $70. Programador: Moises Reyes UNIDAD 2 11 de Octubre del 2018*/ #include <stdio.h> float Na,Cp; int main(...
C
Woo Choi CS362 Quiz 2 Implement inputChar(), *inputString() for random testing. inputChar() will get printable chars from ASCII 32-127. inputString() will get the alphabet (lowercase). testme will start with inputChar() match its char with below chars if (c == '[' && state == 0) state = 1; if (c == '(' && ...
C
//print middle name #include<stdio.h> #include<string.h> void main() { char name[30]; int i; printf("Enter the full name\n"); scanf("%[^\n]%*c", name); for (i = 0; !isspace(name[i]); i++){} i++; printf("Father name is: \n"); for (;!isspace(name[i]); i++) { printf("%c",name[i]); } printf("\n"); }
C
#include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> #include <proc.h> static char **proc_argv; static char *proc_last; int proc_init(char **argv, log_t *log) { int i; char *p; size_t size; extern char **en...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main( void ) { char username[128]; printf( "请输入用户名:" ); fgets( username, 128, stdin ); char *password; printf( "请输入密码:" ); password = malloc( 128 ); gets( password ); printf( "请再次输入密码:" ); char confirm[128]; gets( confirm ); if( strcmp( pas...
C
#include "Header.h" int main(int argc, char *argv[]) { int length = 0; int i = 1; songList* hashTable[128] = { NULL }; songList* head = NULL; char dir[121] = ""; char userInput[121] = ""; if (argc != 2) { printf("No Directory inpputed\n"); } else { do { length = strlen(argv[i]); strcpy(dir, ar...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <gtk/gtk.h> #include "interfaz.h" #include "../model/GameMaster.h" #include "../model/mapper.h" #define ENTRADA 25 #define MAX_ENTRY 25 //Los cuadros para recibir datos, de entrada GtkWidget *player1; GtkWidget *player2; GtkWidget *Pokemon1P1; GtkW...
C
#include<stdio.h> #include<time.h> int main() { time_t biggest =0xffffffff+1; printf("biggest is %s \r\n ",ctime(&biggest)); return 0; }
C
#include<stdio.h> #include<stdlib.h> typedef struct Arv{ char c; struct Arv* dir; struct Arv* esq; }Arv; Arv* arv_criaVazia(){ Arv* a = NULL; return a; } int arv_vazia(Arv* a){ return (a==NULL); //retorna 1 se for NULL } /*Arv* arv_cria(char c, Arv* sae, Arv* sad){ Arv* a ...
C
#include "stack.h" #include <stdlib.h> void stk_init(Stack *p_stack) { p_stack->top = NULL; } void stk_push(Stack *p_stack, void *p_data){ Node *p_node = ref_data(p_data); p_node->link = p_stack->top; p_stack->top = p_node; } int stk_is_empty(Stack *p_stack){ return p_stack->top =...
C
#include <sys/types.h> #include <sys/mman.h> #include <semaphore.h> #include <errno.h> #include <sys/stat.h> #include <sys/fcntl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> char shm_fn[] = "my_shm"; char sem_fn[] = "my_sem"; /**** READER ****/ int main() { caddr_t shmptr; int sh...
C
/** * Copyright 2021 Luis Hsu. All rights reserved. * Use of this source code is governed by a BSD-style * license that can be found in the LICENSE file. */ #include "spectest.h" #include <stdio.h> static int spectest_print(wasm_stack* stack, Store* store) { printf("[Spectest]\n"); return 0; } static int...
C
#include <mpi.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #define TAG 1 int main(int argc, char *argv[]) { //define variables double elapsed_time; int p; int id; double i; double j; double k; int source; int destination; int *package; int package_size; int count; int send_id; MPI_...
C
#include <string.h> #include <stdlib.h> #include <limits.h> #include <gfarm/gfarm.h> #define GFS_GLOB_INITIAL 200 #define GFS_GLOB_DELTA 200 char * gfs_glob_init(gfs_glob_t *listp) { unsigned char *v; v = malloc(sizeof(unsigned char) * GFS_GLOB_INITIAL); if (v == NULL) return (GFARM_ERR_NO_MEMORY); listp->siz...
C
/* ======================================== * * Copyright YOUR COMPANY, THE YEAR * All Rights Reserved * UNPUBLISHED, LICENSED SOFTWARE. * * CONFIDENTIAL AND PROPRIETARY INFORMATION * WHICH IS THE PROPERTY OF your company. * * ======================================== */ #include "project.h" #include <FS.h> #in...
C
#include <stdio.h> int ft_strlen(char *str); int main() { int resp; char str[10] = "12345"; resp = ft_strlen(str); printf("%d\n", resp); }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> int main() { char s[100]; scanf("%s", s); char stack[100]; int i = -1; for(int x = 0; x < strlen(s); x++) { if(s[x] == '[' || s[x] == '(' || s[x] == '{') { stack[++i] = s[x]; } else { if(s[x] =...
C
#define _XOPEN_SOURCE 700 #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <time.h> #include <limits.h> #include <ftw.h> #define SECONDS_IN_DAY (60*60*24) #define osAssert(cond, msg) osErrorF...