language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include<stdio.h> #define TAMANHO 5 void main(){ int num[TAMANHO]; int tam; tam = sizeof(num) / sizeof(num[0]); printf("O tamanho do vetor: %d", tam); }
C
#include <stdio.h> #include <stdlib.h> #include <conio.h> /*##################################################################### Implementation Mode definition ######################################################################*/ // Ʒ 带 // Ÿ ɺ Դϴ. شϴ 쿡 // ĿƮ ˴ϴ. #define SORTED_DATA_MODE //#define STATIC_B...
C
#ifndef _LST_H_ #define _LST_H_ struct lst { lst *prev; lst *next; }; #define INIT_LST(plst) \ { \ (plst)->prev = (plst); \ (plst)->next = (plst); \ } #define LST_EMPTY(plst) ((plst)->next == plst) #define lst_entry(ptr,type,link) ( (type *) ((char *) ptr - (unsigned long) &((type *) 0)->link) ) //在p...
C
/*JSTK-320111 a4_p9_m1.c Tudor Cristian Maiereanu t.maiereanu@jacobs-university.de*/ #include <stdio.h> #include <stdlib.h> #include<string.h> int main() { char s1[100],s2[100],c,l1,l2; int i; /*1-Print on screen the correvt lengths of both strings*/ printf("Enter the first string: "); ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> int main(int argc, char const *argv[]) { int ret; char* execv_argv[] = {"./test1", "123" ,"456" ,"abc",NULL}; printf("caller:pid=%d,ppid=%d\n",getpid(),getppid()); if (execlp("test1","test1", "123" ,"456" ,"abc",NULL) < 0...
C
/******************************************************************************************** Given an amount of money (less than $1.00), compute the number of quarters, dimes, nickels and pennies needed *********************************************************************************************/ #include <stdi...
C
// This is a method of returning a pointer to char. // It returns a literal string. // // Negative // Only works with a string. // // OUTPUT // This is a literal string. #include <stdio.h> #include <string.h> char * return_literal_string() { return "This is a literal string."; } int main(void) { cha...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(){ pid_t pid; pid = fork(); for (int i = 0; i < 3; ++i){ printf("%d\n", i); } }
C
#include "fileControl.h" int8_t get_file_dimensions(const char *file_location, int16_t *lines, int16_t *width){ FILE *fp; (*lines) = 0; (*width) = 0; fp = fopen(file_location,"r"); if (fp == NULL) { printf("gfd: Couldn't open file: %s\n",file_location); return 1; } uint64_...
C
/** @file main.c * @brief Example program using SikendeRTOS features * @date 2/9/2019 */ #include "OS.h" #include "UART0.h" #include "Interpreter.h" #include <stdint.h> #include "cpu.h" // number of threads created by main int ThreadsCreated = 0; // mutex for access to red LED on board Sema4Type...
C
#include "tree.h" #include "bitmap.h" #include <stdlib.h> #include <stdio.h> struct branch { Branch *left, *right, *before; void *data; }; //Funo privada, serve para testar o getWay void checkWay(bitmap bm, Branch *root, Branch *bTest); Branch* tree_newBranch(void *data) { Branch *branch = malloc(sizeof(Branch));...
C
#include "books.h" #include "stdio.h" #include "stdlib.h" static char * zone[]={(char*)"KIDS", (char*)"HIGHSCHOOL", (char*)"ADULT", (char*)"COMICS", (char*)"DOCUMENTARY"}; static char *erro[]={(char*)"E_OK", (char*)"E_ISBORROWED", (char*)"E_ALREADY_IN_LIBRARY"}; char * get_zone_name(Zone z) { return zone[z]; ...
C
#ifndef COMPRESS_H #define COMPRESS_H #include "header.h" // prenche o rray com caracter e fraquencia /** @param frequence: array/ string de frequencias */ /** @param input_filename: arquivo de entrada para leitura*/ /** @return void */ void fill_freq_array(lli* frequence, char input_filename[50]); //cria a lista d...
C
#include <string.h> #include <WinSock2.h> #include "ae.h" typedef struct aeApiState { fd_set rfds, wfds; fd_set _rfds, _wfds; } aeApiState; static int aeApiCreate(aeEventLoop *eventLoop) { aeApiState *state = malloc(sizeof(aeApiState)); if (!state) return -1; FD_ZERO(&state->rfds); FD_ZERO(&s...
C
/** * 136.c * Project Euler Prbl 136 * Created by Zhiming Wang on 02/22/2014. * -------------------------------------- * (4d - x) x = n < N = 50000000, where 0 < d < x. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <assert.h> #define N 50000000 int count[N] = {0}; ...
C
//Zaira E Cruz //September 28,2016 //Client socket code that writes. to proxy server an inputted url //(proxy server then finds IP address of url sends request) and then client //reads from proxy server the message received from the HTTP request. #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #includ...
C
/** * * @file dgetrf.c * * PLASMA computational routines * PLASMA is a software package provided by Univ. of Tennessee, * Univ. of California Berkeley and Univ. of Colorado Denver * * @version 2.6.0 * @author Hatem Ltaief * @author Mathieu Faverge * @date 2009-11-15 * * @generated d Tue Jan 7 11:45:07 ...
C
#include<stdio.h> int main() { int valor1; int valor2; int resultado; int opcion; printf("\n 1.Suma"); printf("\n 2.Resta"); printf("\n 3.Multiplicacion"); printf("\n 4.Division\n"); printf("\nSelecciona la operacion que desea calcular: "); scanf("%d",&opcion); if(opcion == 1) { ...
C
int a; int main(){ for(a=0;a<200;a=a+1){ printf("In Loop\n"); } printf("End Loop\n"); return 0; }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct node { int num; struct node* next; } Node; typedef struct myQueue { Node* queue; Node* head; Node* tail; int cnt; } MyQueue; void init(MyQueue* this) { Node *init = (Node*)malloc(sizeof(Node)); init->num = -1; ...
C
#include<stdio.h> #include<stdlib.h> struct node{ int v; struct node*next; }; struct node*adj[10]; int visited[10]={0}; void DFS(int); void create(int); void main() { int i,n; scanf("%d",&n); for(i=0;i<n;i++) adj[i]=NULL; create(n); for(i=0;i<n;i++) if(visited[i]!=1) DFS(adj...
C
/*************************************************************************** * maze.c * * Labb 3 * Solves a maze using recursive backtracking * * Written by Xiao Lu * March 2016 ***************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <time.h...
C
#include <stdio.h> #include <stdlib.h> int main() { system("cls"); float p, pd; printf("Calculo de desconto de 10%%: "); scanf("%f", &p); pd = (p - (p * 0.1)); printf("Preco com desconto :%0.2f", pd); printf("\n\n"); return 0; }
C
complex add_complex(complex x, complex y) { complex z; z.real = x.real + y.real; /* 実数部分の和 */ z.imaginary = x.imaginary + y.imaginary; /* 虚数部分の和 */ return z; } /* 二つの複素数の積を返す */ complex multiply_complex(complex x, complex y) { complex z; z.real = (x.real * y.real) - (x...
C
#include <stdio.h> #include <string.h> int main() { char strA[10] = "House"; printf("strA before memmove\n"); printf("The info in strA is %s\n", strA); if(memmove(strA+0, strA, strlen(strA))){ printf("The data in strA have been moved\n"); printf("strA is %s\n", strA); } else printf("Error...
C
/* * Copyright (c) 2017-2018 Ilya Kaliman * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISC...
C
#include <stdio.h> int main(){ float funcionario; printf("Quanto o funionario recebe?\n"); scanf("%f",&funcionario); if (funcionario<300){ funcionario += (funcionario*0.35); printf("Salario reajustado para R$:%f\n",funcionario); } else{ ...
C
#include "include/lexer.h" #include <stdio.h> int main(int argc, char** argv) { lexer_t* lexer = lexer_new(argc, argv); token_t* token = (void*)0; while((token = lexer_get_next_token(lexer)) != NULL) { printf("Token(%s, \"%s\")\n", token_type_as_string(token), token->value); } lexer_destr...
C
/* * GraphPatternDrawing.c * WHYDFML * * Created by Daniel Jalkut on 7/22/06. * Copyright 2006 Red Sweater Software. All rights reserved. * */ #include "G5VentPatternDrawing.h" #define H_PATTERN_SIZE 10 #define V_PATTERN_SIZE 10 static void MyDrawColoredPattern (void *info, CGContextRef myContext) { sta...
C
#include <stdio.h> int main(void) { int food; printf(" . \n 1.ġ 2.ֵ 3.ҶҶ"); scanf_s("%d", &food); if (food == 1) { printf("ġ\n"); } if (food == 2) { printf("ֵ\n"); } if (food == 3) { printf("ҶҶ\n"); } }
C
// here is a CUnit based example of unit testing the "swaps" library from example03 // steps: // 0. download and install CUnit from https://sourceforge.net/projects/cunit-msvc/, the assertions you can use: http://cunit.sourceforge.net/doc/writing_tests.html#assertions // 1. right click on Header Files and add exis...
C
#ifndef _LIST_PRINT_ #define _LIST_PRINT_ #include <stdio.h> #include "cell.h" void put_space(int level) { while (level-- > 0) { putchar(' '); } } void pprint(cell* c, int level) { //put_space(level); if (c == NULL) { //put_space(level); fprintf(stderr, "\npprint: null pointer\n"); return; } ...
C
#include<stdio.h> long factorial(int); int main() { int i,j,n,sp,c; printf("Enter how many lines: "); scanf("%d",&n); for(i=0; i<n; i++) { for(sp=1; sp<i-n; sp++) printf(" "); for(c=0; c<=i; c++) { printf("%ld ",factorial(i)/(factorial(c...
C
#include "desvio_padrao.h" double media_aritmetica(double valores[], int num_valores){ int i; double media = 0.0; for(i = 0; i < num_valores; i++) media += valores[i]; return media/num_valores; } double desvio_padrao(double valores[], int num_valores){ return sqrt(variancia(valores, num_valores)); } double v...
C
#include <stdio.h> int main() { float average(float array[],int n); int i; float score1[5],score2[10],aver1,aver2; printf("Aѧijɼ:"); for(i=0;i<5;i++) { scanf("%f",&score1[i]); } aver1=average(score1,5); //Ϊʵ printf("Aƽɼǣ%f\n",aver1); printf("Bѧijɼ:"); for(i=0;i<...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <sys/types.h> void * read_thread(void * args) ; void * write_thread(void * args) ; int data = 0 ; pthread_rwlock_t rwlock ; int main() { int i = 0 ; pthread_t readThread[10] ; pthread_t writeThread[3] ; pthread_rwlock_init(&rwlock,NULL) ; //...
C
#include<stdio.h> #define size 5 void main(){ int n[size]={0}; int i; for(i=0;i<size;i++){ printf("%d ",n[i]); } printf("\n"); }
C
#include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <sys/stat.h> #include <sys/time.h> #include <stdint.h> #define COPY_BUFFER_MAXSIZE 2048 void main() { /* unsigned char *buffer = NULL; buffer = malloc(COPY_BUFFER_MAXSIZE); if (!buff...
C
/* * StockTransaction.c * * Created on: Feb 14, 2019 * Author: hikar */ #include <stdio.h> int main() { double shares = 1000, initial = 45.5, final = 56.9; printf("Initial price of stock: %.2f\n", initial); printf("Commission for purchase: %.2f\n", shares*initial*.02); printf("Price at wh...
C
#include <stdio.h> void main() { int m, n, p, q, i, j, a[4][4], b[4][4]; printf("enter the dimension of matrice 1"); printf("\nenter the number of rows: "); scanf("%d",&m); printf("enter the number of columns: "); scanf("%d",&n); printf("the dimensions of the matrice is: %d x %d",m,n); printf...
C
/*! * \copyright This file is part of the AREPO code developed by Volker Springel. * \copyright Copyright (C) 2013 by Volker Springel (volker.springel@h-its.org) * \copyright and contributing authors. * * \file src/dust_live/grain_sizes.c * \date MM/YYYY * \author * \brief * \details * *...
C
// Copyright (c) 2015-2017 Nuxi, https://nuxi.nl/ // // SPDX-License-Identifier: BSD-2-Clause #include <sys/mman.h> #include <pthread.h> #include <signal.h> #include <stdbool.h> #include <stdlib.h> #include <testing.h> #include <unistd.h> TEST(pthread_cond_signal, zero) { pthread_cond_t cond; ASSERT_EQ(0, pthrea...
C
#include <SDL.h> #include "game.h" #include "game-render.h" static int bind[GAME_NBUTTONS]; static SDL_Window *window; static SDL_Renderer *renderer; int game_init(const char *title, int width, int height, int kb[GAME_NBUTTONS]) { if (SDL_Init(SDL_INIT_VIDEO) != 0) return -1; window = SDL_CreateWindow(title, SD...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* errors.c :+: :+: :+: ...
C
#include "z80.h" #include "struct.h" #include "define.h" static void printing(char *s1, char *s2, char *s3, int size, t_mem *mem) { if (PRINT & 1) read_mem_bytes(mem, size); if (PRINT & 2) printf(" %s %s, %s", s1, s2, s3); printf("\n"); } static unsigned char bit_x_x(int bit_n, int set, unsigned char a, t_mem ...
C
/* Fazer um programa que receba três números obrigatoriamente em ordem crescente e um quarto número que não siga essa regra. Mostre, em seguida, os quatro números em ordem decrescente. Suponha que o usuário digitará quatro números diferentes.*/ #include <stdio.h> int decrescente (int x,int y,int z,int w) { if(x>w)...
C
#include "manager.h" #include <string.h> void listProduct(Product *p,int count){ printf("===========================\n"); for(int i=0;i<count;i++){ if(p[i].price==-1) continue; printf("%2d", i+1); readProduct(p[i]); printf("\n"); } printf("\n"); } int selectDataNo(Product *p, int ...
C
// Client side implementation of UDP client-server model #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <sys/time.h> #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> #include "common/eridan...
C
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ void check (int top,int mid , int bottom ,int heit, char gender, char skill, char xtm,int Class){ printf("nhap vao gioi tinh cua ban:(M-F)"); scanf("%c",&gender); system("cls...
C
#include<stdio.h> int main(){ int testcases; int i=1; int distance,speed; double res,result; scanf("%d",&testcases); while(testcases-- > 0){ scanf("%d %d",&distance,&speed); res = (distance * (9.806))/(speed * speed); if(res > 1 ...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(void) { int n; scanf("%d", &n); int i, j, k; int cnt = 0; for (i = 1; i <=n; i++) { for (j = 1; j <=i; j++) { for (k = 1; k <=j; k++) { if (i + j + k == n) { if (i < j + k) { cnt++; } } } } } printf("%...
C
#include "reporting.h" #include <fcntl.h> #include <stdio.h> #include <string.h> #include <sys/times.h> #include <time.h> #include <unistd.h> static int reporting_status = 0; static int fd; static struct timespec timespec_start, timespec_stop; static struct tms tms_start, tms_stop; static int create_error(char* mess...
C
#ifndef __INTERNAL_COMMANDS_H #define __INTERNAL_COMMANDS_H enum commands { CD = 1, EXIT, }; #include <string.h> #include <stdio.h> #include <wait.h> // Comando interno da acsh "cd" void acsh_cd(char *dir); // Comando interno da acsh "exit" void acsh_exit(int status); // Verifica se string (entrada do usuár...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef int Elem; typedef enum bool{false, true} bool; typedef struct DynamicArray { size_t capacity; // 数组的容量,初始值和最小值均为16u size_t size; // 数组中元素的个数 Elem* data; // 用于保存数组中元素的内存空间 } DynamicArray; /* * ┏┓   ┏┓ * ┏┛┻━━━┛┻┓ * ┃       ┃   ...
C
#include<stdio.h> void countcharacters(char s[]) { FILE *fp;//File handle declaration char ch; int alphacount=0,digitcount=0,spacecount=0,specialcount=0; fp=fopen(s,"r"); while((ch=fgetc(fp))!=EOF) { if((ch>='a' && ch<='z') ||(ch>='A' && ch<='Z'))//chech for alphabet alphacount++; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strnstr.c :+: :+: :+: ...
C
// // Filename : MakeGraph.C // // Author : Suhan Ree // Date : 07-02-2004 // This C++ program is used to generate the regular graph // with N nodes and 2*E*N links, with each node originating 2*E directional // links. All nodes are numbered from 0 to N-1, and destinations of // links from i-th node are i-E, i-E+1...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> struct data{ char name[64]; } struct fp{ int(*fp)(); } void executeShell(){ char *name[2]; name[0] = "/bin/sh"; name[1] = NULL; execve(name[0], name, NULL); } void Failed(){ printf("You failed to exploit the heap\n"); } int int main(int argc, char const...
C
# include <stdlib.h> # include <stdio.h> # include <math.h> # include <time.h> # include "mpi.h" int main ( int argc, char *argv[] ); double f ( double x ); void timestamp ( void ); /******************************************************************************/ int main ( int argc, char *argv[] ) /***************...
C
#include<stdio.h> #include<stdlib.h> int main(){ int i, numero, intervalo=0; for(i=0; i<=10; i++){ printf("Digite um numero: "); scanf("%d", &numero); if(numero>=30&&numero<=90){ intervalo++; } } printf("\nNumeros entre 30 e 90: %d\n", intervalo); return 0; }
C
#include <ctype.h> #include <string.h> #include "dna_utils.h" void vcfGetTv(const char *in_vcf, const char *out_vcf){ htsFile *in_fp = hts_open(in_vcf, "r"); bcf_hdr_t *hdr_in = bcf_hdr_read(in_fp); bcf1_t *rec = bcf_init1(); htsFile *out_fp = hts_open(out_vcf, "w"); bcf_hdr_t *hdr_out = bcf_hdr_dup(hdr_...
C
/******************************************************************* Multi-Part Model Construction and Manipulation ********************************************************************/ #include <stdlib.h> #include <stdio.h> #include <math.h> #include <gl/glew.h> #include <gl/glut.h> #include "Vector3D.h" #include...
C
#include<stdio.h> void repeater (int arr[],int size){ int i,j; int count=1; for(i=0;i<size;i++) { for(j=i+1;j<size;j++){ if (arr[i]==arr[j]) { return count=count+1; } } } } int main(){ int arr[100]; int size=5; for(int i=0...
C
#include<stdio.h> #include<stdlib.h> int main(void) { int number, i; printf("Enter an integer:"); scanf_s("%d", &number); i = number % 2; if (i == 0) { printf("The integer is even."); }else { printf("The integer is odd."); } system("pause"); return 0; }
C
#include "get_next_line.h" #include <stdio.h> int line_search(int fd, char **str, char **line) { char *tmp; int newline; char *found; found = ft_strchr(str[fd], '\n'); !(ft_strchr(str[fd], '\n')) ? newline = 0 : \ (newline = (ft_strlen(str[fd]) - ft_strlen(found))); if (str[fd][newline] == '\n') { *line =...
C
/* On permute chaque 2 cases qui sont voisines dans le bon ordre, arrivé à la fin, si il y'a eu une seule permutation, on refait le parcours une fois aucun changement n'a été fait, le tableau est trié. */ // Meilleur: O(n) -- Pire : O(n²) void TriBulle(long T[], long n) { int Changement = 1; long i; while (Cha...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <string.h> void userlogin(void); char x[100]; struct user{ char username[10]; char password[10]; }*pUser; int main() { userlogin ( ); return 0; } void userlogin(void){ FILE *out; FILE *ot; FILE *fp; char uName[10], pwd[...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> // 0 head // 1 || // 2 || // 3 tail // 4 typedef struct DequeItem{ struct DequeItem* previous; void* data; struct DequeItem* next; } DequeItem_t; typedef struct LinkedDeque{ DequeItem_t* head; DequeItem_t* tail;...
C
/* -*- Mode:C; Coding:us-ascii-unix; fill-column:132 -*- */ /* ****************************************************************************************************************************** */ /** @file hdf5NewFile.c @author Mitch Richling <https://www.mitchr.me/> @Copyright Copyright 1998 by Mitch Ric...
C
#include "BST.h" #include <stdlib.h> BSTNode *createBSTNode(ElementType data) { BSTNode *temp = malloc(sizeof(BSTNode)); temp->data = data; temp->left = NULL; temp->right = NULL; return temp; } BSTNode *rinsertBSTNode(BSTNode *root, ElementType data) { if(root==NULL) return createBSTNo...
C
/*--------------------------------------------------------------------------*/ /* util/trans_station_ascii.c (SOB 0.22 ATS Version 1.32) */ /*--------------------------------------------------------------------------*/ /* target : ഫxWɪҵ{ */ /* create : 02/12/08 b...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include "scanner.h" #include "global.h" #include "syntax_analysis.h" int retvalue; //kód chyby int EOL_flag = 0; string atr; int is_term(int token){ if (token == IDENTIFIER || token == INT || token == FLOAT_N || token == STRING_LIT...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 10000 /* // know that function that make private copies, not changing the actual value. void swap(int x, int y){ int tmp = x; x = y; y = tmp; printf("In swap function, x is %d after swapped, y is %d after swapped\n", x, y); } void s...
C
#include<stdio.h> void hanoi_tower(int n,char from,char tmp,char to) { if(n==1) printf("원판 1을 %c에서 %c으로 옮긴다.\n",from,to); else { hanoi_tower(n-1,from,to,tmp); printf("원판 %d을 %c에서 %c으로 옮긴다.\n",n,from,to); hanoi_tower(n-1,tmp,from,to); } } int main(void) { hanoi_tower(4,'A','B','C...
C
/** * @file fifo_buffer.h * @brief fifo_buffer include file * * @version $Revision$ * @date $Date$ * @author albert.liao * * @par Fixes: * None. * @par To Fix: * None. * @par Reference: * None. ***************************************************************************** ...
C
//------------------------------------------------------ // SC̬űԵıű // ߣ27651 // ʱ䣺2008-12-16 //------------------------------------------------------ #ifndef _SC_SYMBOL_TABLE_H #define _SC_SYMBOL_TABLE_H //м #include "SCCodeTable.h" //ú struct CSCFunction; //-----------------------------------...
C
#include "vm/page.h" #include <stdio.h> #include <stdbool.h> #include <string.h> #include "threads/thread.h" #include "userprog/pagedir.h" #include "threads/malloc.h" #include "threads/palloc.h" #include "threads/vaddr.h" #include "threads/synch.h" #include "userprog/pagedir.h" #include "filesys/file.h" #include "userp...
C
// #include <stdio.h> int main (void) { int i=1; while(i<=10){ printf("%d \n",i*i); i++; } }
C
#include<stdio.h> #include<stdlib.h> #include<stdbool.h> #include<string.h> #pragma warning (disable : 4996) //QUADRABLES #define ADD_ 10 #define AND_ 25 #define OR_ 26 #define ASSIGN_ 1 #define DECLARE_ 0 #define DEC_ 16 #define DIVIDE_ 13 #define DOWHILE_ 22 #define EQUALEQUAL_ 33 #define NOTEQUAL_ 32 #define FOR_ ...
C
#include <system.h> #include <shell.h> char * Readline = ""; int ReadLineIndex = 0; int NumberOfCommands; command_table_t CommandTable[MAX_COMMANDS]; void init_shell() { add_new_command("help", "Tipe: help <command>, to get help!", help_command); add_new_command("", "", empty_command); } void help_comm...
C
#include<stdio.h> #include<stdlib.h> struct node{ int data; struct node *n; }; struct node *top=NULL; void insert(){ struct node *temp=(struct node*)malloc(sizeof(struct node)); printf("enter data\n"); scanf("%d",&temp->data); if(top==NULL){ top=temp; top->n=NULL; return; } temp->n=top; top=temp; } voi...
C
/************************* includes **********************************/ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <stdint.h> #include <math.h> /************************* defines ***********************************/ #define KISS_MAX 4294967296.0 /* maximum RNG siz...
C
#include<stdio.h> int arr[30][30]; int max_fun(int a,int b,int c){ return (a>=b)?((a>=c)?a:c):((b>=c)?b:c); } int find(int i,int j,int r,int c){ int max,res[3]={0}; if(j>=c) return 0; else{ if(i-1<r&&i-1>=0) res[0]=find(i-1,j+1,r,c); if(i<r&&i>=0) ...
C
#include<stdio.h> #include<pthread.h> #include<unistd.h> //面条数量 int g_noodle = 0; #define THREADCOUT 4 pthread_mutex_t g_mutex; void* MakeStart(void* arg) { while(1) { pthread_mutex_lock(&g_mutex); printf("make g_noodle %d\n",g_noodle); g_noodle++; pthread_mutex_unlock(&g_mut...
C
#ifndef __TRANS_FD_H__ #define __TRANS_FD_H__ #include <sys/types.h> #include <sys/socket.h> // malloc #include <stdlib.h> #include <string.h> #include "../socket/sockettools.h" // transfer fd to int write_fd(int sfd, int cfd) { msghdr msg; iovec iov[1]; char buf[1]; iov[0].iov_base = buf; // 这个东西没什么用,但是不加的话...
C
#include <stdio.h> void BubbleSort(int a[], int n) { int i, j, temp, flag = 1; for (i = 0; i < n - 1 && flag; i++) { flag = 0; for (j = n - 2; j >= i; j--) { if (a[j] > a[j + 1]) { temp = a[j]; a[j] = a[j + 1]; a[j + 1] = temp; ...
C
#include <stdio.h> #include <unistd.h> /* void char_pipe_reader(char * buffer, FILE *ptr){ */ void char_reader(char * buffer, FILE *ptr){ buffer[0] = getc(ptr); } int char_writer(char * buffer, FILE *ptr){ return putc(buffer[0], ptr); } int main() { FILE *ptr; ptr = fopen("t.txt","w"); putc('\0',ptr);...
C
#include<stdio.h> int main(void) { int i, a,b,c,count = 0; for (i = 100; i < 1000; i++) { a = i % 10; //ȡλ b = i / 10 % 10; //ȡʮλ c = i / 100; //ȡλ if (a + b + c == 5) { printf("%-4d", i); count++; if (count % 5 == 0) printf("\n"); } } return 0; }
C
#include "tcp_tunnel.h" #include "iam_config.h" #include "tcp_tunnel_state.h" #include <apps/common/string_file.h> #include <apps/common/device_config.h> #include <modules/iam/nm_iam_state.h> #include <apps/common/random_string.h> #include <modules/iam/nm_iam_serializer.h> #include <stdio.h> #include <string.h> bool ...
C
/* * Copyright (c) 2003-2011 Objective Systems, Inc. * * This software is furnished under a license and may be used and copied * only in accordance with the terms of such license and with the * inclusion of the above copyright notice. This software or any other * copies thereof may not be provided or otherwise ma...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_square.c :+: :+: :+: ...
C
/** * Author: Hannah Shin * Date: 2021/08/26 * Class: CSE155E Chris Bourke * * A simple program to say my major * */ #include <stdlib.h> #include <stdio.h> int main(int argc, char **argv){ printf("Computer Science\n"); printf("Hannah Shin!\n"); printf("Claire Anderson\n"); printf("Comput...
C
#include<stdio.h> int main() { int sum,num; printf("Enter the num\n"); scanf("%d",&num); sum=0; while(num) { sum=sum*10+num%10; num=num/10; } printf("sum=%d\n",sum); }
C
#include "fs.h" #include "ext2_fs/ext2.h" #include <fcntl.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int init_fs(const char *image_path) { current_fs = initialize_ext2(image_path); current_sb = current_fs->get_superblock(current_fs); return !(current_fs && current_sb); } struct file *openfi...
C
#include <echidna.h> #include <ll.h> #include <parameter.h> #include <runtime.h> #include <value.h> int standard_and(ECHIDNA *Context, const char *Name, LL *Parameters, VALUE *Result, void *User) { PARAMETER *pParameter; VALUE sIn, sValue; Result->Type = TYPE_NONE; value_initialise(&sValue); ll_...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* input.c :+: :+: :+: ...
C
//======================================================================== // Single Floating-Point Arithmetic //======================================================================== // Simple test which does single floating-point arithmetic #define TRUE 1 #define FALSE 0 #define EPSILON 0.0001f int float_equal(fl...
C
// // sum.c // // Calculates the sum of a list of numbers // #include <stdio.h> int main(void){ int list_count; puts("How many numbers are there in the list ?"); scanf("%d", &list_count); puts("Enter the numbers separated by spaces ?"); int i = 0; int sum = 0; while(i < list_count){ int num; s...
C
#include <stdio.h> int main(void) { int a,b,c; printf("请输入两个正整数:"); scanf("%d,%d",&a,&b); while(b){ c=a%b; a=b; b=c; } printf("他们的最大公因子是%d。\n",a); return 0; }