language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <cs50.h> int checksum(long long int number); int numlen(long long int number); int get_special_bit(long long int number, int location, int length); long long int ten_power(int time); int add_by_bit(int number); int main(void) { printf("Number: "); long long number = GetLongLong();...
C
#include <stdio.h> #include <math.h> void printprime(int start, int end); int isprime(int num); int main(void) { int n1, n2; printf("Enter start and end to print prime numbers: "); scanf("%i%i",&n1,&n2); if(n1<2) { n1=2; if(n2>2 && n1<n2) { printpr...
C
/* * Frame.c * * Created on: Mar 24, 2021 * Author: Esraa Abdelnaby */ #include <stdint.h> #include "Error_codes.h" #include "Frame.h" static uint8_t Frame_Check_Buffer (uint8_t * UserBuffer,uint16_t size); uint8_t Frame_Construct_buffer(uint8_t * UserBuffer,uint16_t size,uint8_t * Constructed_buff, uint1...
C
#include "stdio.h" #include "stdlib.h" #include "string.h" void revStr(char* str,char* result); void main() { char *str,*result; str=(char*)malloc(100); printf("Enter a String: "); gets(str); realloc(str,sizeof(char)*(strlen(str)+1)); result=(char*)malloc(sizeof(char)*(strlen(str)+1)); revStr(str,result); pr...
C
/* 6. Accept distance in centimetre and convert into meter. 1 meter = 100 Centimeter Input : 87 Output : 0.87 */ #include<stdio.h> float ConvertToMeter(float); float ConvertToMeter(float num) { float meter=0.0; meter = num / 100; return meter; } int main() { float num=0.0,ans=0.0; printf("Enter Centimet...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <stdlib.h> int factorielle(int n) { if (n == 1) { return 1; } return n* factorielle(n-1);//ݹ } int main4() { int n = 0; printf("һ\n"); scanf("%d", &n); printf("%d", factorielle(n)); system("pause"); return 0; }
C
/* * list.h * * x-kernel v3.2 * * Copyright (c) 1993,1991,1990 Arizona Board of Regents * * * $Revision: 1.2 $ * $Date: 1993/02/01 22:40:16 $ */ /* * A generic singly-linked list */ #ifndef list_h #define list_h struct list_entry { struct list_entry *next; /* next element */ }; struct list_head...
C
/* * Copyright (C) 2009-2011 by Benedict Paten (benedictpaten@gmail.com) * * Released under the MIT license, see LICENSE.txt */ #include "cactusGlobalsPrivate.h" //////////////////////////////////////////////// //////////////////////////////////////////////// //////////////////////////////////////////////// //Fun...
C
// // Created by leon on 2017/8/25. // #include "jnilog.h" #include "filelib.h" #include <string.h> #include <stdio.h> #include <stdlib.h> long get_file_size(char *file) { FILE *fp = fopen(file, "rb"); fseek(fp, 0, SEEK_END); long size = ftell(fp); fclose(fp); return size; } /** * 分割文件 */ JNIE...
C
#include<stdio.h> int main() { // ex -1 int num = 0; while(num < 5) { printf("hello world! %d\n", num); num++; } // ex -2 int dan = 0, num = 1; printf(" ? "); scanf("%d", &dan); while(num < 10) { printf("%d x %d = %d\n", dan, num, dan*num); num++; } // ex -3 ...
C
/* 华清远见项目实训 - 文件服务器 * * socket.c 文件服务器Socket封装 * 提供文件服务器Socket封装的实现 * * 作者: Ma Xiaobo * 日期: 2018-11 */ #include "socket.h" #include "tools.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/stat.h> #include <fcntl.h> static char _recv_buf[RECV_BUF_SIZE]; /* 创建一个So...
C
//构造函数的显式定义 //由于在大多数情况下我们希望在对象创建时就完成以些对成员属性的初始化等工作,而默认的构造函数无法满足我们的要求,所以我们需要显式定义一个构造函数来覆盖掉默认构造函数以便来完成必要的初始化工作,当用户自定义构造函数后编译器就不会再为对象生成默认构造函数。 //在构造函数的特点中我们可以看到,构造函数的名称必须和类名相同,并且没有返回值和返回类型。 #include <iostream> using namespace std; class Point{ public: Point(){ //声明并定义构造函数 cout < <"自定义的构造函数被调用...\n"; xPos = 100...
C
#include "utils.h" pthread_mutex_t mutex_print = PTHREAD_MUTEX_INITIALIZER; #define SIZE_BUFFER_STAMP 64 char buffer_stamp[SIZE_BUFFER_STAMP] = {0}; void printf_stamped(const char * prefix, const char * fmt, ...) { time_t time_date = time(NULL); struct timespec time_nsec = {0}; // TODO: TODO_CROSSPLAT clock_ge...
C
#include "image.h" #include <stdint.h> #include <stdio.h> #include <stdlib.h> image_t* rotate90(image_t* image, ROTATE_DIRECTION dir){ uint32_t x, y; uint32_t width, height; image_t *result; if ( NULL == image || (dir!=CW && dir!=CCW) ) return NULL; width = image->width; height = image->height; result ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "symtable.h" #define SYMTABSIZE 1000 int curScopeLevel; struct SymTableEntry *symbolTable[SYMTABSIZE]; struct SymbolStack *varList; struct SymbolStack *declaration; static char *typeName[] = {"Boolean", "Integer", "Real", "String", "Array", "Void"}; ...
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
/* vfs.c =============================================================================== MIT License Copyright (c) 2007-2016 Michael Lazear 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 Software ...
C
#include<stdio.h> #define N 30 #define M 4 int fichabus [N][M]; int fila, col; int boleto=125; int ver();int listado(); int aleatorio(); int viajexrecaudacion(); void menu(); int kilometros(); main(){ int op; do{ menu(); scanf("%i",&op); switch(op){ case 1:ver(); break ; case 2:listado();aleatorio();break ...
C
/** * @file unittesting.c * @brief Contains functions definitions and main function for unittesting * using CMOCKA framework and libraries. Makefile present to run the * testing and create .exe file. * @author Andrew Kuklinski and Mason Darveaux * @date 10/25/2017 **/ #include <stdio.h> #include <stdint.h> #include ...
C
#include <stdio.h> #include <stdlib.h> int main() { float x; scanf("%f", &x); if (x < -19) printf("The function value at this value of the parameter: %f", (2 * x * x * x + 8 * x * x)); else if (x >= 23) printf("Function does not exist at this parameter value."); else...
C
// // Created by 范宏昌 on 2018/5/20. // #ifndef CMCUP_UTILS_H #define CMCUP_UTILS_H #include <stm32f10x.h> #define NULL 0 #ifdef DEBUG #define debug(string) println(string) #else #define debug(string) while(0){} #endif void* kernel_memcpy(void* dst, void* src, int len); void* kernel_memset(void* dst, int b, int len...
C
// This is a file for the class ViewerPink which // is used in class-example.c #include <glib.h> #include <glib-object.h> #include "viewer-pink.h" // We define the type with three args: // - Name of the type in camelcase (for values with that type) // - Name of the type in lower_case (I think, for generating some func...
C
#include<stdio.h> #include<unistd.h> #include<string.h> #include<stdlib.h> #include<sys/types.h> int main(void) { int fd1[2],nbytes=1,fd2[2],a=0; pid_t pid; char string[80]; char readbuffer[80]; char ch='a',ch1='\n'; FILE *fp; pipe(fd1); pipe(fd2); if((pid=fork())==-1) { perror("fork");...
C
#include <stdlib.h> // added to eliminate impl decl. #include <stdio.h> #include <string.h> // removed duplicated string.h include int is_palindrom(char *a); int main() { char original_string[100], current_string[100]; printf("Enter the string to check if your can find palindrom substring is it\n"); // mod text to ...
C
#include "calculate_next_board.h" #include "is_index_out_of_bounds.h" uint8_t count_alive_neighbours(bool* board, uint16_t board_size, uint16_t row_num, uint16_t col_num){ uint8_t count = 0; for(int8_t i = -1; i <= 1; i++) { for(int8_t j = -1; j <= 1; j++) { uint8_t row_index = row_num + i; uint8_t col_inde...
C
#include <stdio.h> int main(){ char s[5][20],temp,sou[5]={0}; for (int i=0;i<5;i++){ scanf("%s",s[i]); } for (int i=0;i<5;i++){ for (int j=0;s[i][j]!=NULL;j++){ if(s[i][j]>sou[i]){ sou[i]=s[i][j]; } }} for(int i=0;i<5;i++){ printf("%c",sou[i]); } }
C
# include <stdlib.h> # include <stdio.h> # include <math.h> # include <time.h> # include <string.h> # include "pdflib.h" # include "rnglib.h" /******************************************************************************/ double i4_binomial_pdf ( int n, double p, int k ) /******************************************...
C
// ---------------------------------------------------------------------------- // define the cumulative beta function (used for tilting) in samon. // ---------------------------------------------------------------------------- #include "samon_env.h" #include "beta_cdf.h" double beta_cdf( double x, double a, double b...
C
#include <stdio.h> void f(int a[]) { printf("f: number of elements %d\n", sizeof(a) / sizeof(a[0])); } int main(void) { int a[] = {1, 2, 3, 4, 5}; printf("main: number of elements %d\n", sizeof(a) / sizeof(a[0])); f(a); return 0; }
C
/* ** EPITECH PROJECT, 2020 ** function ** File description: ** function for my_printf */ #include <stdarg.h> #include "../../include/my.h" #include "../../include/set.h" #include <stdio.h> const struct point flags[] = { {'i', &my_print_int}, {'d', &my_print_int}, {'s', &my_print_string}, {'S', &my_pr...
C
#include<stdio.h> #include<stdlib.h> struct stack{ int value; struct stack *NEXT; }*top; typedef struct stack stack; void push(int ele){ stack *ptr=(stack *)malloc(sizeof(stack)); ptr->value=ele; ptr->NEXT=top; top=ptr; } void pop(){ if(top==NULL){ printf("stack is empty\n"); ...
C
/* ** display_winner.c for PSU_2016_lemipc in /home/gogo/rendu/tek2/PSU_2016_lemipc/bonus/graphic_code/display_winner.c ** ** Made by Gauthier Cler ** Login <gauthier.cler@epitech.eu> ** ** Started on Sun Apr 02 18:00:27 2017 Gauthier Cler ** Last update Sun Apr 02 18:00:27 2017 Gauthier Cler */ #include "lem_ipc....
C
#include<stdio.h> #include<stdlib.h> int sum,a[1000000],n,k[1000000],i,max; int main(void) { scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); k[a[i]]++; if(a[i]>max) max=a[i]; } for(i=1;i<max;i++) { if(k[i]>=2 ) sum=sum+2; else if(k[i]...
C
#include<stdio.h> int main() { int x, x_star, x_p; //x, x*, x' int y, y_star, y_p; //y, y*, y' int compare; int Sbox[16] = {0x1, 0xa, 0x4, 0xc, 0x6, 0xf, 0x3, 0x9, 0x2, 0xd, 0xb, 0x7, 0x5, 0x0, 0x8, 0xe}; // int Sbox[16] = {0xd, 0x0, 0x8, 0x6, 0x2, 0xc, 0x4, 0xb, 0xe, 0x7, 0x1, 0xa, 0x3, 0x9, 0xf, 0x5}; int count...
C
#include <stdio.h> #include <string.h> int main() { int n, i; scanf("%d", &n); for(i = 0; i < n; i++){ char input[51]; int right_shift; scanf("%s", input); scanf("%d", &right_shift); int j, len = strlen(input); for(j = 0; j < len; j++){ char c = in...
C
#include <stdio.h> int main(void) { int a; char b; float c; a = 5; b = 'a'; c = 3.14; printf("a=%d b=%c c=%f", a, b, c); }
C
#include <stdio.h> int main(int argc, char * argv[]) { int x, y; for (x = 0; x < 6; x++) { for(y = x; y >= 0; y--) { printf("#"); } printf(" "); for (y = x; y < 6; y++) { printf("*"); } printf("\n"); } return 0; }
C
#include <stdio.h> #include <pthread.h> #include <stdlib.h> int a[100000]={0}; int n=0; typedef struct node { int start; int end; } NODE; void merge(int low, int high) { int i=0; int j=0; int k=0; int mid = (low+high)/2; int left = mid - low + 1; int right = high - mid; int t1[...
C
/* Prints all even and odd numbers from 0 to 10 */ #include <stdio.h> int main(){ printf("EVEN NUMBERS:\n"); for (int x = 0; x <= 10; x++){ if (x % 2 == 0){ printf("%d\n",x); } } printf("ODD NUMBERS:\n"); for (int x = 0; x <= 10; x++){ if (x % 2 != 0){ ...
C
/* uCoders */ /* Paint Program (Third Part in the Project) */ /* Team number : 2 */ /* IDs: 2 - 4 - 10 - 14 - 41 */ /* Team Leader: Ahmed Mohammed Gamal Al-Din */ /* Release Date : 16/8/2019 */ #include <stdio.h> #include <st...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #define BUFFER_SIZE 1024 #define on_error(...) { fprintf(stderr, __VA_ARGS__); fflush(stderr); exit(1); } int main(int argc, char *argv[]) { time_t timer; char b...
C
#include<stdio.h> #define m 5 #define n 3 void print_array(int arr[], int size){ for(int i = 0; i < size; i++){ printf("%d", arr[i]); } printf("\n"); } int main(void) { int arr1[m] = {1,2,3,4,5}; int arr2[n] = {6,7,8}; int new_array[m+n]; for(int i = 0; i < m; i++){ new_...
C
#ifndef __CATARRAY_H__ #define __CATARRAY_H__ #include <stdlib.h> struct category_tag { //Write code here for this struct char* category; char** wordlist; size_t n_words; }; typedef struct category_tag category_t; struct catarray_tag { //Write code here for this struct category_t** catlist; size_t n_cats; };...
C
/* * Simple examples demonstrating the use of LEDs and switches using ASF. * * Created: 30/11/2012 14:55:14 * Author: Grzegorz Cielniak */ /* * Include header files for all drivers that have been imported from * Atmel Software Framework (ASF). */ #include <asf.h> #define Switch_Init() (gpio_enable_gpio_p...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> /** * ַڴڶ,Ҳջ,Ҳȫֳ */ int main22(int argc,char *argv[]) { /** * ʼַļַʽ *Ҳһ,һ̶Сڴ */ char buf[] = "abc"; printf("sizeof=%d\n", sizeof(buf));//4 С,\0 printf("strlen=%d\n", strlen(buf));//3 ַ,\0 char buf1[] = { 'b','c...
C
/** @file * @brief Common defines for IR NEC protocal data. */ #include "sems_ir_actuator.h" #pragma once /** * @brief Holde NEC data, which will be sent. */ typedef struct { uint8_t address; /*< Address code. */ uint8_t command; /*< Command code. */ uint8_t repeat; /*< Repeat c...
C
#include <stdlib.h> #include "xmalloc.h" void* xmalloc(size_t bytes) { return malloc(bytes); } void xfree(void* ptr) { free(ptr); } void* xrealloc(void* prev, size_t bytes) { return realloc(prev, bytes); }
C
/* *********************************************** */ /* */ /* by: hgrranzi <vkh.mariia@gmail.com> */ /* */ /* *********************************************** */ #ifndef STACK_H # define STACK_H # include <stdl...
C
/** @file Interfejs obsługująca vector. @ingroup structers @author Michał Jaroń @copyright Uniwerstet Warszawski @date 2015-05-31 */ #ifndef __VECTOR_H__ #define __VECTOR_H__ #include <stdlib.h> #include <stdio.h> #include <wchar.h> #include "trie.h" /** Struktura reprezentująca listę dzieci. * Dynam...
C
#ifndef SHARED_HEADER_FILE #define SHARED_HEADER_FILE #include <arpa/inet.h> #include <stdbool.h> #include <stdlib.h> #include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <string.h> #define MAX_THREADS 10 #define NUM_TILES_X 9 #define NUM_TILES_Y 9 #define htonll(x) ((1==htonl(1)) ? (x) : ((uint64_t...
C
#include <stdio.h> #include <sys/types.h> /* Primitive System Data Types */ #include <unistd.h> #include <sys/wait.h> int main(void) { fprintf(stdout,"Parent PID:%d\n",getpid()); fflush(stdout); while(fork()) wait(NULL); fprintf(stdout,"My PID:%d and My Parent PID:%d\n",getpid(),getppid()); return 0; }
C
#include "Include.h" #define FLASH_DESTION 0x08003000 #define PAGE_SIZE 0x400 #define FLASH_PAGES 116 //128-12 #define PACKAGE_SIZE 256 #define PROGRAM_ALL_PACKAGES 464 //FLASH_PAGES*4 FLASH_Status FLASHStatus = FLASH_COMPLETE; /*********************************************************** **** ڲӦóFlash...
C
/* Napisati funkciju int broj_neparnih_cifara(int x) koja određuje broj neparnih cifara u zapisu datog celog broja. Testirati rad ove funkcije u programu koji učitava cele brojeve dok se ne unese nula i ispisuje broj neparnih cifara svakog unetog broja. */ #include <stdio.h> #include <stdlib.h> int broj_neparnih_cifa...
C
#include <stdio.h> #include <assert.h> #include <sys/mman.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <semaphore.h> void* malloc_shared(size_t size) { return mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0); } void free_sha...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* setenv_bultin.c :+: :+: :+: ...
C
/* Slip 2-1 Write a C program to evaluate a given polynomial using function. */ #include<stdio.h> #include<conio.h> #include<math.h> void create(int [], int); void display(int [], int); int eval(int [], int, float); void main() { int x[10], m, n; int val; clrscr(); printf("Enter highest degree of...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
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> #include <cs50.h> #include <ctype.h> #include <string.h> bool check_key(string); string cipher(string, string); int main(int argc, string argv[]) { if (argc != 2 || check_key(argv[1])) { printf("Provide key (26 chars) as command line parameter.\n"); return 1; } // R...
C
#include <stdio.h> double findMedianSortedArrays(int* nums1, int nums1Size, int* nums2, int nums2Size) { int i = 0; int j = 0; int indexNum1 = 0; int indexNum2; indexNum2 = (nums1Size + nums2Size) / 2 - indexNum1; for(i = indexNum1; i < nums1Size; i++) { for(j = indexNum2; j >= ...
C
#include "ysh.h" size_t ysh_tablen(char **tab) { char *start; start = NULL; if (tab) { start = *tab; while (*tab++); } return ((size_t)(*tab - start)); }
C
#include "stdio.h" #include "lcd.h" #define WIDTHEIGHT 480 #define HEIGHT 272 void init_uart(); int main(void) { int c = 0; init_uart(); // 初始化LCD控制器 lcd_init(); // 打印菜单 while(1) { printf("\r\n###############lcd test##############\r\n"); printf("[1] lcd_clear_screen\r\n"); printf("[2] lcd_draw_cross...
C
#include<stdio.h> #include<string.h> int main() { char str[20]; int strlen; scanf("%s %d",str,strlen=strlen(str)); printf("%d",strlen); printf(strlen+1); }
C
/* * ===================================================================================== * * Filename: compress.c * * Description: 压缩函数 * * Version: 1.0 * Created: 2013年11月10日 11时19分53秒 * Revision: none * Compiler: gcc * * Author: lgt, lgtcarol@gmail.com ...
C
#include<stdio.h> void encrypt(char str[], int k){ for(int i=0;str[i]!='\0';i++){ if((str[i]>='a' && str[i]<='z')){ str[i]=(str[i]-'a'+k)%26 + 'a'; }else if(str[i]>='A' && str[i]<='Z'){ str[i]=(str[i]-'A'+k)%26 + 'A'; } } } void decrypt(char str[], int k){ fo...
C
#include "labels.h" Label Labels[255]; int iiLabels = 0; int mlabelCount = 0; extern CycleStack* cycleStack; void GetNextLabel(char* dest) { sprintf(dest, "L%d", mlabelCount++); } const char* FindLabelCodeName(const char* originalName) { for(int i = 0; i < 255; i++) { if (0 == strcmp(originalName, Labels[i].ori...
C
//Buatlah contoh program perhitungan apa saja (boleh perkalian atau pembagian) #include <stdio.h> // V = tegangan, i = arus , r = hambatan int V(int i, int r){ int D; D = i * r ; return D; } int main(){ printf("Aplikasi Menghitung Tegangan Listrik\n"); int a,b; printf("masukan aru...
C
/* * ============================================================= * * Project: apue * * Filename: cliconn.c * * Editor: vim :set et ts=2 sts=2 sw=2 * * Author: Martin Y. Yang , yang@libpix.org * * Description: * * ======================================================...
C
#include<stdio.h> #include"sum.c" //int sum(int *a,int n); int array[2]={1,2}; int main() { int val=sum(array,2); printf("%d",val); return val; }
C
#include <stdio.h> #include <stdlib.h> struct node{ int x; int y; struct node *next; }; void createList(struct node **V); void createList2(struct node **V, int x, int y); int ask(); struct node *createNode(int x,int y); void printList(struct node *); void freeList(struct node **V); int ripasso(struct node...
C
#include <stdio.h> #include <windows.h> #include <string.h> #include <time.h> int main(){ int w; char gg[200],nombreArchivo[10]; HANDLE hfile; char cadenas[10][15]= {"silla","pastel","forma","casual","intenso","combinacio","memoria","contexto","portable","contador"}; char ruta[100]; printf("\nIngr...
C
#include "taxi.h" void print_list(node_t * head) { node_t * current = head; while (current != NULL) { printf("Titular%s\n", current->titular); printf("Modelo%s\n", current->modelo); printf("Patente%s\n", current->patente); printf("Marca Carro%s\n", current->marca_carro); printf("Modelo Carro %s\n...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strmjoin.c :+: :+: :+: ...
C
#include<stdio.h> int main() { int bt[10],p[10],wt[10],n,total=0,pos,temp,i,j; float avwt; printf("Enter number of process:"); scanf("%d",&n); printf("\nEnter Burst Time:\n"); for(i=0;i<n;i++) { printf("p%d:",i+1); scanf("%d",&bt[i]); p[i]=i+1; } ...
C
#include "util.h" int sign(int x) { unsigned int y = x; return (x >> 31) | ((-y) >> 31); } int main(int argc, char** argv) { if(argc != 2) exit(0); int x = atoi(argv[1]); printf("argument :%d\n", x); printf("sign :%d\n", sign(x)); }
C
/*Creates a datagram server. POrt number is passed as an argument. This server runs forever To run: gcc secondserver.c -o secondserver ./secondserver 4547 For ack timerfunctionality execution, close server terminal, and try to send request datagram */ #include <sys/types.h> #include <sys/socket.h> #include <netine...
C
#include <libsystem/Atomic.h> #include <libsystem/CString.h> #include <libsystem/Logger.h> #include <libsystem/io/Stream.h> #include "kernel/memory/Memory.h" #include "kernel/memory/Physical.h" #include "kernel/memory/Virtual.h" static bool _memory_initialized = false; extern int __start; extern int __end; MemoryR...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <sys/time.h> #include <assert.h> #define SEED 921 int min(int a, int b) { if (a > b) return b; return a; } double mysecond() { struct timeval tp; struct timezone tzp; int i; i = gettimeofday(&tp,&tzp); re...
C
// // Exercise-10.h // Assignment-1 // // Created by Desislava Stoyanova on 9/5/15. // Copyright (c) 2015 Desislava Stoyanova. All rights reserved. // #ifndef Assignment_1_Exercise_10_h #define Assignment_1_Exercise_10_h void bubbleSort(char** array,size_t size,size_t maxStringLen) { int i,j; char* temp =...
C
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Contains profiling code. * \file IceProfiler.h * \author Pierre Terdiman * \date April, 4, 2000 */ ///////...
C
#include "stdio.h" #include "stdlib.h" #include "string.h" #include "sys/types.h" #include "sys/socket.h" #include "arpa/inet.h" #include "netinet/in.h" #define SA struct sockaddr int main() { int sockfd,len; char ip[30],mac[30]; struct sockaddr_in servaddr; //creating socket sockfd = socket(AF_INET,SOCK_DGRAM,0); //f...
C
// // main.c // dspd2 assignment2 // // Created by Official on 06/04/20. // Copyright © 2020 Official. All rights reserved. // // // Note : Implemented A.V.L Tree #include <stdio.h> #include <stdlib.h> #include <string.h> #define HASHSIZE 11 #define NAMESIZE 10 //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Typedefs <<<<<<...
C
#include <stdio.h> int main(void) { #ifdef __linux__ printf("Hello World\n"); #else printf("Goodbye World\n"); #endif return 0; }
C
#include <stdint.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> struct Rc; typedef void (*Disposer)(struct Rc*); typedef void (*RcCleanupFunc)(void*); typedef void (*RcRetainFunc)(void*); // classes and interfaces runtime support struct MethodTable { size_t iface; struct...
C
#include <assert.h> #include "widgets.h" #include "common.h" #include "debug.h" inline static void scroll_check_data(scroll_struct *scroll) { assert(scroll->outer_box != NULL); assert(scroll->list.entries != NULL); assert(scroll->disp_item_idx_first <= scroll->list.size); assert(scroll->disp_item_idx_selected <= s...
C
status cmd_whisper(string str) { object ob; string who; string msg; string cap_name; if ((int)this_player()->query_ghost()) { write("You fail.\n"); return 1; } if (!str || sscanf(str, "%s %s", who, msg) != 2) { write("Whisper what?\n"); return 1; } who = lower_case(who); ob = find_p...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char op,st[100]; int cont=0,i; do{ // USANDO LAO DO WHILE PODEREMOS REPETIR VARIAS VEZES O PROGRAMA cont=0; printf("Digite uma palavra: ___"); gets(st); //PARTE DO PROGRAMA QUE RECEBE A STRING for(i=0;st[i]!='\0';i...
C
#include "lib.h" int factorial(int arg) { if (arg == 0 || arg == 1) { return 1; } return arg * factorial(arg - 1); } int main() { int a = 10; printf("Factorial of %d is %d\n", a, factorial(a)); return 0; }
C
#include "cfl_parser.h" #include <stdio.h> #include <string.h> extern void* cfl_parser_malloc(size_t size); cfl_token_list* cfl_create_token_list_node(char* start, unsigned int length) { cfl_token_list* result = cfl_parser_malloc(sizeof(cfl_token_list)); if(!result) return 0; result->start = st...
C
#include <stdlib.h> #include <stdio.h> int main(){ //Allows you to generate random number //we don't need random number here, so just comment this line //srand(time(NULL)); // Allows user to specify the original array size, stored in variable n1. printf("Enter original array size:"); int n1=0; scan...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_output1_fd.c :+: :+: :+: ...
C
#include "push_swap.h" static void set_push(t_list_nb **src) { if ((*src)->next == *src) *src = NULL; else { (*src)->next->prev = (*src)->prev; (*src)->prev->next = (*src)->next; *src = (*src)->next; } } void push_b(t_stack *stack) { t_list_nb *tmp; t_list_nb *tmp2; tmp = stack->list_a; tmp2 = stac...
C
#pragma once #include <cstdio> #include <stdint.h> #include <memory> #include "gl/glew.h" #include "Render.h" #include "Shader.h" #define GLM_FORCE_RADIANS static Render::RenderObject* CreateCubeRO(float size, ProgramPtr program) { const float s = size; const Vertex vertices[] = { // front Vertex(glm::vec3(-...
C
/* ** xml_gettag.c for xml_parseur in /home/mart_p//XML ** ** Made by louis martin-pierrat ** Login <mart_p@epitech.net> ** ** Started on Mon Jun 3 17:13:06 2013 louis martin-pierrat ** Last update Mon Jun 3 19:00:01 2013 louis martin-pierrat */ #include <stdlib.h> #include "xml_struct.h" #include "xml_define.h...
C
#include <stdio.h> #include <math.h> #include <string.h> int main() { char input1[35] = { 0, }, input2[35] = { 0, }; scanf("%s %s", &input1, &input2); long long temp, sum1 = 0, sum2 = 0; for (int i = 0; i < strlen(input1); i++) { temp = pow(2, strlen(input1) - 1 - i) * (input1[i] - '0'); sum1 += ...
C
#include <stdio.h> int main() { int bil, hasil; scanf("%d", &bil); hasil = bil % 4; switch (hasil) { case 0: printf("NOL\n"); break; case 1: printf("SATU\n"); break; case 2: printf("DUA\n"); break; case 3: printf("TIGA\n"); break; } retu...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "liresudoku.h" #include "formules.h" #include "to_dimacs.h" //Convertit le fichier dimacs en sudoku static void read_dimacs(char *filename,unsigned int sudoku_size, sudoku *a); //Ecrit le fichier dimacs correspondant à la Formule f static void writ...
C
#include<stdio.h> #include<stdlib.h> #include "encription.h" int main() { int t ; printf("Enter the number of Test case (Range : 0 < t < 10^4) : "); scanf("%d",&t); printf("\nEnter value P , Q and Encripted message ...(eq : 53 59 2929 (range p,q : 0 < (p,q) < 10^4 , o < msg < 10^8))\n"); int i ...
C
#include <stdio.h> long fib(int n); int main(void) { int n,ri,repeat; scanf("%d",&repeat); for(ri=1;ri<=repeat;ri++){ scanf("%d",&n); printf("fib(%d)=%ld\n",n,fib(n)); } } long fib(int n){ long result; if (n==0) result=0; else if(n==1) result=1; else result=fib(n-2)+fib(n-1); return result; }