language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "WPILib.h"
#include <math.h>
#ifndef DRIVETRAIN_H
#define DRIVETRAIN_H
float oldStickLeftInput = 0.0;
float oldStickRightInput = 0.0;
float useleft = 0.0;
float useright = 0.0;
float leftchange = 0.0;
float rightchange = 0.0;
#define kDeadzoneThreshold 0.04 //kDeadzoneThreshold = 0.02;
//#define kJoystickCh... |
C | //
// main.c
// 多项式乘法
//
// Created by Surface Laptop 2 on 2019/8/16.
// Copyright © 2019 Surface Laptop 2. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
struct Node{
int coef;
int expn;
struct Node *next;
}Node;
typedef struct Node *PNode;
typedef struct Node *Position;
PNode MakeE... |
C | 1.Program to check if the given character is a vowel or consonant
#include <stdio.h>
void vowel_or_consonant(char ch)
{
if ((ch == ‘a’ || ch == ‘e’ || ch == ‘i’ || ch == ‘o’ || ch == ‘u’) || (ch == ‘A’ || ch == ‘E’ || ch == ‘I’ || ch == ‘O’ || ch == ‘U’))
printf(“Vowel\n”);
else
print... |
C | #include <stdio.h>
float get_average(float kamoku[]); /* prototype declaration */
int main(){
int i;
float kokugo[10],eigo[10];
for(i = 0; i < 10; i = i+1){
scanf("%f%f",&kokugo[i],&eigo[i]);
}
printf("kokugo no heikin = %5.1f\n",get_average... |
C | /*
* hardware abstraction layer for LEDs
*
* LED 0, 1, 2: red
* LED 3, 4: green
*/
#ifndef LED_H_
#define LED_H_
#include "stm32f4xx.h"
typedef enum {
LED_OFF = 0, LED_ON = 1, LED_TOGGLE = 2
} ledState;
uint16_t LED_GPIO[5];
/*
* initializes output pins
*/
void led_Init(void);
/*
* sets a new LED state
*... |
C | #include <stdio.h>
#include <stdlib.h>
#include "strfuncs.h"
#define WORD_DELIM " .,?!:;-"
int input_str(char *str)
{
size_t i = 0;
int result = EXIT_SUCCESS;
while (1)
{
char c = str[i] = (char)getchar();
if (c == '\n' || c == '\0' || c == EOF)
{
i... |
C | #include "fila.h"
#include "tipos.h"
#include <stdlib.h>
#include <stdio.h>
int vazia(struct fila *f){
if(f->quant_atual==0)
return 1;
else return 0;
}
struct fila * inicializar_fila(){
struct fila *f = malloc(sizeof(struct fila));
f->inicio = NULL;
f->fim = NULL;
f->quant_atual = 0;
... |
C | #include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
void
make_fd_nonblocking(int fd)
{
int old_flags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, old_flags | O_NONBLOCK);
}
int
main(int argc, const char **argv)
{
make_fd_nonblocking(STDIN_FILENO);
int value = 0;
int rc = ... |
C | /*
* Quick example to test dht22 temperature and humidity sensor, printing
* samples via serial uart.
*/
/*
* Copyright 2015 Martyn Welch <martyn@welchs.me.uk>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the followin... |
C | #include "eigenvalues.h"
#include <omp.h>
#include <math.h>
#include <assert.h>
#include "mkl.h"
inline double secularEquation(double lambda, double roh, double* z, double* D, int n, int* G) {
double sum = 0;
int i;
#pragma omp parallel for default(shared) private(i) schedule(static) reduction(+:sum)
... |
C | /* fontwidth - calculate font widths from convert 24-bit RGB pixels
Base on work by by Glenn Randers-Pehrson <glennrp@users.sf.net>
Reads an RBG image from stdin and looks for white pixels representing
character widths.
Use with ImageMagick or GraphicsMagick to convert 24-bit RGB pixels
to 16-bit BGR565 pi... |
C | // Program to print Fibonacci sequence using loop //
/* Name - Ankush Kumar
Class - CSE_156_A2
*/
#include<stdio.h> //PREPROSESSIVE DIRECTIVE TO INCLUDE STANDARD LIBRARY INPUT OUTPUT HEADER FILE
int main() //STARTING OF MAIN PROGRAM
{
int n, firstnum = 0, secondnum = 1, next, i; /*DECLARING VARIABLE... |
C | #include "fillit.h"
int get_gr_size(int tetcode)
{
if (tetcode == 0)
return (22);
else if ((tetcode >= 3 && tetcode <= 6) || (tetcode >= 9 && tetcode <= 12))
return (23);
else if ((tetcode >= 7 && tetcode <= 8) || (tetcode >= 13 && tetcode <= 18))
return (32);
else if (tetcode == 1)
return (41);
else
r... |
C | #include "pbc.h"
#include "alloc.h"
#include <stdlib.h>
#include <stdio.h>
static void*
read_file (const char *filename , int * size) {
FILE *f = fopen(filename, "rb");
if (f == NULL)
return NULL;
fseek(f,0,SEEK_END);
long sz = ftell(f);
fseek(f,0,SEEK_SET);
void * buffer = malloc(sz);
fread(buffer, 1 , sz ,... |
C | #include"header.h"
int main()
{
char ch_n[MAX]; // size of array in strings form
char ch_p[MAX];
char ch_a[MAX];
int p;
int n; // size of array
int a; // number of char to be appended
char *s; // source string
char *d; ... |
C | //this program is to count the number of character iin each word
//and then display it in the form of vertical histogram
#include <stdio.h>
#define MAXLENS 15
int main(){
int flag = 0, count = 0, w[MAXLENS + 1], i, j, MAXWORDS;
char ch;
for(i = 0;i < MAXLENS + 1; i++)
w[i] = 0;
while( (ch = getchar... |
C | /*
** list_sort.c for in
**
** Made by julien gein
** Login <gein_j@epita.fr>
**
** Started on Tue Oct 2 20:44:38 2001 julien gein
** Last update Wed Dec 19 12:05:27 2001 julien gein
*/
#include "data_struct.h"
void list_sort(t_list **list, t_cmpfunc cmp)
{
t_list *tmp;
t_list *tmp2;
t_list *save_pos;
... |
C | #include<stdio.h>
main()
{
struct account{
int acNum;
char acType[10];
float bal;
}ac;
ac.acNum=1;
strcpy(ac.acType,"Student");
//ac.acType[10]="Student";
ac.bal=123.45;
printf("Account Number: %d",ac.acNum);
printf("\nAccount Type: %s",ac... |
C | /* Bottom up approach. we start with the tabular matrix approach
* by initializing matrix using base case and then build the soln
* to the top
*
* - we omit the recursive call and just use the matrix.
* Change the calls to iterative.
* - derive bottom-up code from recursive */
/* n rows and w cols */
static i... |
C | // Write a program in C to separate the individual characters from a string
#include<stdio.h>
void main()
{
char a[20];
int l=0,i;
printf("Enter anything in string\n");
fgets(a,sizeof(a),stdin);
for ( i = 0; a[i]!='\0'; i++)
{
printf("%c ",a[i]);
}
} |
C | #include "sift.h"
/**
Filter out points on the boundaries.
The function returns oframes, which
contains the row, col and the interval number
**/
F2D * filterBoundaryPoints(int M, int N, F2D *oframes) {
int i, k = 0, m = 0;
int cnt;
I2D *sel;
F2D *ret;
cnt = 0;
for(i = 0; i < oframes->width; i++) {
... |
C | #include <stdio.h>
#include <omp.h>
#include <time.h>
#include <sys/time.h>
#include <stdlib.h>
#define NC 10000 // Number of lines
#define NL 5000 // Number of columns
/* This fuction allocate a matrix dynamically*/
double **alloc_Matrix(int nl,int nc)
{
double **mat=(double**)malloc(nl*sizeof(double *));
fo... |
C | /*
**指针基础
*/
#include<stdio.h>
main(){
int a,b;
int *pointer_1, *pointer_2;
int c;
a=100;
b=50;
pointer_1=&a;
pointer_2=&b;
//pointer_1--;
//pointer++;
//(pointer_1)++;
//(pointer_2)++;
c = *pointer_1 + 10;
//pointer_2 = pointer_1; //make pointer_2 turn to a
... |
C | /* This software is distributed under the Lesser General Public License */
/*
* Parse the input file and print the output to a json file.
*/
#include "gml_parser.h"
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char* argv[]) {
struct GML_pair* list;
struct GML_stat* stat=(struct GML_stat*)m... |
C | //Binary search
#include<stdio.h>
int main()
{
int i, first, last, middle, m, search, array[100];
printf("Enter number of elements in ascending order:\n");
scanf("%d",&m);
printf("Enter %d integers:\n", m);
for (i = 0; i < m; i++)
scanf("%d",&array[i]);
printf("Enter the value to find:\n");
scanf("... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct ListNode {
int val;
struct ListNode* next;
};
int getLength(struct ListNode* head)
{
int len = 0;
struct ListNode* p = head;
while (p) {
++len;
p = p->next;
}
return len;
}
struct ListNode* getIntersectionNod... |
C | #include <stdio.h>
#include <stdlib.h>
/* Simple function to read from a text file.
* TODO: read this file remotely using RPC */
void get_text(void) {
FILE *fp;
int c;
fp = fopen("txt_to_read.txt", "r");
while((c = getc(fp)) != EOF)
putchar(c);
fclose(fp);
}
int main(void) {
get_text();
return 0;
}
|
C | /*
** EPITECH PROJECT, 2018
** PSU_zappy_2017
** File description:
** start
*/
#include <stdio.h>
#include "game.h"
#include "parser.h"
#include "selector.h"
/*
** Adds the teams specified in the parser to the game.
*/
static void add_teams(game_t *gm, list_t *teams)
{
while (teams->l_size) {
game_add_team(gm, lis... |
C | /*
* mk_lookup_tables.c
*
* Computes the temperature and battery
* lookup tables for converting 16-bit raw measurements
* from the wireless sensors to actual floating point values.
*
* Ioannis Panagopoulos <ioannis@cslab.ece.ntua.gr>
* Vangelis Koukis <vkoukis@cslab.ece.ntua.gr>
*
*/
#include <math.h>
#inclu... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <linux/ptrace.h>
int auth(char *login, int serial)
{
login[strcspn(login, "\n")] = 0;
int len = strnlen(login, 32);
if (len > 5)
{
// Detect tampering
if (ptrace(0, 0, 1, 0) == -1)
{
puts("\033[32m.----------------------------.");
puts... |
C | #include "hash_tables.h"
/**
* key_index - Returns the index of a key
* @key: key represented as a string
* @size: size of the array of hash table
* Return: final_index (index of the key)
*/
unsigned long int key_index(const unsigned char *key, unsigned long int size)
{
unsigned long int index, final_index;
in... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
char st[20];
int top=-1;
void push(char x)
st[++top]=x;
char pop()
{
if(top==-1)
return -1;
else
return st[top--];
}
int prior(char x)
{
if(x=='('||x==')')
return 0;
if(x=='+'||x=='-')
return 1;
if(x=='*'||x=='/')
return 2;
if(... |
C | /*
* Dose2 for Android by Gautier Portet
* JNI Wrapper
* */
#include <jni.h>
#include <time.h>
#include <android/log.h>
#include <android/bitmap.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define LOG_TAG "dose2"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
#de... |
C | #include <stdio.h>
#include <string.h>
void swap(char **q1,char **q2)
{
char *temp;
temp = *q1;
*q1 = *q2;
*q2 = temp;
}
void exchange(char **p1,char **p2,char **p3)
{
if(strcmp(*p1,*p2)>0) swap(p1,p2);
if(strcmp(*p1,*p3)>0) swap(p1,p3);
if(strcmp(*p2,*p3)>0) swap(p2,p3);
}
int main()
{
... |
C | #include <stdio.h>
#define NONBLANK 'a'
main()
{
int c, lastc;
lastc = NONBLANK;
while (c = getchar() != EOF)
if (c != ' ')
putchar(c);
else if (lastc == ' ')
putchar(c);
lastc = c;
printf("%d %d\n", c, lastc);
}
|
C | #include"Disas.h"
#include"Loader.h"
#include <sys/stat.h>
#include <sys/types.h>
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#endif
long fileSize = -1;
byte * readFile(char * path) {
struct stat s;
byte * newMem = NULL;
if (stat(path, &s)<0) {
return NULL;
}... |
C | #ifndef PLAIN_PTYES_H
#define PLAIN_PTYES_H
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
typedef int(*producer)(int n, ...); /* n is the number of varargs */
struct _Operation {
producer opt; /* a function that represents an operation. There are 4 basic operations:
... |
C | //
// Created by Greg Steinbrecher on 3/4/17.
//
#include "h5_interface.h"
#include "hdf5.h"
#include <stdio.h>
#include <stdlib.h>
#define DIM0 4
#define DIM1 7
#define NDIMS 2
int write_uint64_dataset(char *filename, char *dataset, size_t *dims, size_t ndims, uint64_t *data) {
hid_t file, space, dset;
herr_t ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int nhapGiaTri();
void nhapMang(int mang[], int n);
void xepMang(int mang[], int n);
void swap(void* a, void* b, size_t size);
void hienMang(int mang[], int n);
int main()
{
printf("Nhap so luong phan tu\n");
int n;
int mang[n = nhapGiaTri()];
... |
C | #include "floppy.h"
#include "utility.h"
#include "ports.h"
#include "memman.h"
#include "kmalloc.h"
#include "timer.h"
#include "interrupts.h"
unsigned char * driveTypes[8] = {
"none",
"360kB 5.25\"",
"1.2MB 5.25\"",
"720kB 3.5\"",
"1.44MB 3.5\"",
"2.88MB 3.5\"",
"unknown type",
"unk... |
C | #ifndef COLOR_H_
#define COLOR_H_
#include <stdint.h>
typedef struct {
uint8_t green;
uint8_t red;
uint8_t blue;
} rgb_t;
typedef struct {
uint16_t h;
uint16_t s;
uint16_t v;
} hsv_t;
rgb_t hsv2rgb(hsv_t c);
#endif
|
C | #ifndef __VALIDATION_H__
#define __VALIDATION_H__
#include<stdio.h>/
int validation(int x,int y);//Ϸ֤
int validation(int x,int y){
if(0<=x&&x<=y)
return x;
else{
printf("ȷַ\n");
getchar();
fflush(stdin);
return x=-1;
}
}
#endif
|
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
//-------------------------循环语句-------------------------
// 1、while循环
// 输出 0 ~100 的所有整数
int n = 0;
while(n<=100) // ()里面的条件成立就执行循环语句,直到条件不成立
{
printf(" %d",n);
n++; // 自增的变量
}
// 输出100以内的所有偶数,每10个为一行
int value = 0;
int count = 0; // 统计偶数的个数... |
C | #include<stdio.h>
int main()
{
char name[20];
float weight,height,BMI;
printf("Please enter your name: ");
gets(name);
printf("\nEnter the basic details");
printf("\nWEIGHT(in pounds): ");
scanf("%f",&weight);
printf("\nHEIGHT(in inches): ");
scanf("%f",&height);
BM... |
C | #include <stdio.h>
#include <getopt.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
struct FLAGS
{
char * num; //-n flag
char * file; //-f flag
bool suppress; //-R flag
bool hostname; //-a flag
bool nlocal; //-d flag
bool udomain; //-w flag
};
int main(int argc,... |
C | /*3 – Criar uma matriz [5X5] do tipo real. Responder o que se pede:
a) Informar o seu maior elemento e sua posição;
b) Informar a soma de cada linha;
c) Informar a média de cada linha;
d) Informar a soma e a média de todos os elementos.*/
#include <stdio.h>
#define TAMANHO 5
int main()
{
double matriz[TAMANHO][TA... |
C | #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>
//skeleton code copied from http://www.linuxhowtos.org/data/6/client.c, written by LinuxHowtos
//the basic framework for creating the socke... |
C | #include"ArbolB.h"
ArbolBinario CrearNodo(itemA x)
{
ArbolBinario r=(ArbolBinario)malloc(sizeof(ArbolBinario));
r->dato=x;
r->izq=r->der=NULL;
return r;
}
void NuevoArbol(ArbolBinario *r, itemA x, ArbolBinario ramaizq, ArbolBinario ramader)
{
*r=CrearNodo(x);
(*r)->izq=ramaizq;
(*r)->der=ramader;
... |
C | //
// Created by Administrator on 2020/8/14 0014.
//
/*
* 变量其实只不过是程序可操作的存储区的名称。
* C 中每个变量都有特定的类型,类型决定了变量存储的大小和布局,该范围内的值都可以存储在内存中,运算符可应用于变量上。
* 变量的名称可以由字母、数字和下划线字符组成。它必须以字母或下划线开头。大写字母和小写字母是不同的,因为 C 是大小写敏感的。
*
* 单精度浮点值。单精度是这样的格式,1位符号,8位指数,23位小数。
* 双精度浮点值。双精度是1位符号,11位指数,52位小数。
*
* 定义: 就是告诉编译器在何处创建变量的存储,以及如何创建变量的存... |
C | #include <stdio.h>
#include "sn_common.h"
#include "avl_tree.h"
/* for LL type of AVL tree to rotate.
* k2
* / \
* k1 d -> k1
* / \ / \
* b c b k2
* / / / \
* a a c d
*/
AVL_NODE *LL_rotation(AVL_NODE * k2)
{
AVL_NODE *k1 = NULL... |
C | #include<stdio.h>
#include<conio.h>
#define temp 0
#define perm 1
#define infinity 9999
#define nil -1
int pathlen[8];
int predecessor[8];
int status[8];
int adj[8][8]={{0,0,2,7,0,0,0,0},{0,0,0,0,0,16,0,0},{5,0,0,4,0,0,3,0},{0,0,0,0,9,0,0,0},{4,0,0,0,0,5,0,0},{0,0,0,0,0,0,0,0},{0,0,6,3,4,0,0,0},{0,0,0,0,0,2,5,0}};
void... |
C | /**
* \file arbq.h
* \author Andreux Simon
* \version 1.0
* \date 30 nov 2012
* \brief include de arbq.c
*
* \details Contient les prototypes des fonctions relatives aux arbre quaternaires
*
*/
#ifndef __arbq_h_
#define __arbq_h_
#include "couleur.h"
/**
* \enum type enum
* \bri... |
C | /*
* @Author: Kazuya Takahashi
* @Date: 2019-02-06 15:40:34
* @Last Modified by: Kazuya Takahashi
* @Last Modified time: 2019-02-06 23:32:54
*/
#include <stdio.h>
char *vc_strrev(char *str)
{
printf("==================\n%1$s\n==================\n", __func__);
char *reverse;
int counter = 0;
whil... |
C | #include<stdio.h>
#define _BSD_SOURCE
#include<stdlib.h>
#include<pthread.h>
#include<unistd.h>
#include<ctype.h>
#include<string.h>
int SharedVariable=0;
// initializing thread related variables
pthread_mutex_t lock;
pthread_barrier_t barrier;
// Thread function to modify the shared variable
void* SimpleThread(void ... |
C | #include "libmx.h"
static int **push_zero(int V) {
int **res = (int**) malloc(sizeof(int*) * V);
for(int i = 0; i < V; i++) {
res[i] = (int*) malloc(sizeof(int) * V);
for(int j = 0; j < V; j++) {
res[i][j] = 0;
}
}
return res;
}
static int get_index(char **words, ch... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <unistd.h>
#include <wait.h>
#include <dirent.h>
#include <ctype.h>
DIR *getDir(char *basePath);
FILE *getLog(char *dirPath);
char *getAge(char *input);
bool isRegularFile(const char *path);
void downloadExtr... |
C | #include "stdarg.h"
// @NOTE: Draws the grid that the hexagon grid goes on top of.
// Used for debugging.
NVGcolor
get_color(Color color) {
switch(color) {
case(WHITE):
return nvgRGBf(1,1,1);
break;
case(RED):
return nvgRGBf(1,0,0);
break;
case(GREEN):
return nvg... |
C | #include "libmx.h"
void *mx_memmove(void *dst, const void *src, size_t len) {
char *d = (char *)dst;
char *s = (char *)src;
unsigned char *tmp = malloc(len);
for(unsigned int i = 0; i < len; i++)
tmp[i] = s[i];
for(unsigned int i = 0; i < len; i++)
d[i] = tmp[i];
free(tmp);
... |
C | /*
** EPITECH PROJECT, 2017
** minishell
** File description:
** built_move_folder
*/
#include "my.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int how_long_tab(const char **tab);
char **move_folder(char **env, char *argu);
char **move_racine(char **env);
char *get_value_var_env(char *var);
char *fin... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include "register.h"
#include "book_management.h"
#include "interface.h"
void Login_menu()
{
int i;
char * logname = (char *)malloc(sizeof(char)*99);
char * logword = (char *)malloc(sizeof(char)*99);
printf("Please enter your username: ");
... |
C |
#include <input_manager.h>
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
static int StdinDevInit(void)
{
struct termios tTTYState;
//get the terminal state
tcgetattr(STDIN_FILENO, &tTTYState);
//turn off canonical mode
tTTYState.c_lflag &= ~ICANON;
//minimum of number input ... |
C | /*
* Output a model in Dynare model code format
*
* walk through an enode tree
* analyze
* print in inorder with proper placing of ()
*
* and substitute user function calls
*
*/
#include "outovtmdl.h"
#include "outvtmdl.h"
#include "outotmdl.h"
#include "isismdl.h"
#include "string.h"
static int sumval; /* ... |
C | /* Termtime.c is a c program that takes commandline arguments in the form of minutes
and sets the countdown timer for that amount in minutes.
When the timer is up it askes you to start again
TO DO - change the time to update to digital timer after 60 seconds has been counted.
*/
#include <stdio.h>
#include <stdlib.h>... |
C | /**
* Write a function to delete a node (except the tail) in a singly linked
* list, given only access to that node.
*
* Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third
* node with value 3, the linked list should become 1 -> 2 -> 4 after calling
* your function.
*
* https://leetcode.c... |
C | #include <flipper/atmegau2/megausb.h>
/* Receive a packet using the appropriate interrupt endpoint. */
int8_t megausb_interrupt_receive(void *destination, lf_size_t length) {
/* If USB is not configured, return with error. */
if (!megausb_configuration) {
return lf_error;
}
/* Select the endpoint that has been... |
C | #include "holberton.h"
/**
*mul - multiply 2 numbers
*@a: first number given by user
*@b: second number given by user
*
*Return: Result of the multiplication
*/
int mul(int a, int b)
{
int mul;
mul = a * b;
return (mul);
}
|
C | #include "resource.h"
List* textures = NULL;
void deleteResource(Resource* r)
{
if(r == NULL)
return;
//printf("Freed: %s\n", r->name);
free(r->name);
deleteTexture(r->data);
free(r);
}
void initResourcesManager()
{
if(textures == NULL) {
textures = list_init();
//printf("Resources Manager Initialized\n... |
C | /*
*
*******************************************************************************
The MIT License (MIT)
Copyright (c) <2015> <Anand Girish>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
i... |
C | //dynamicallly allocating memory
#include<stdio.h>
int main(){
int i,*p,n;
printf("Enter the number of integers to be entered :");
scanf("%d",&n);
p=(int *)malloc(n*sizeof(int));
if(p==NULL){
printf("Mermory not available");
return 1;
}
for(i=0;i<n;i++){
printf("Enter th Integer\n");
scanf("%d",p+i); ... |
C | #include "holberton.h"
/**
* rev_string - reverses string
* string_length - finds length of the string
* @s: s str
*
* string_length - (char *pointer)
*/
void rev_string(char *s)
{
int string_length(char *);
int length, c;
char *begin, *end, temp;
length = string_length(s);
begin = s;
end = s;
for (c = 0... |
C |
#include "next.h"
#include "fileblock.h"
#include "fileblocklist.h"
#include <stdlib.h>
#include "tester.h"
static FILEBLOCKLISTP
create_fileblocklist(int numblocks)
{
FILEBLOCKLISTP fblist ;
fblist = fileblocklist_create(numblocks) ;
return fblist ;
}
static int
destroy_fileblocklist(FILEBLOCKLISTP fblist)
{
... |
C | #include <stdio.h>
#include "function.h"
int main (int argc, char *argv[])
{
const struct customer Person[] = {
{{6,5,0,9,2,3,0,1,1,5,9}, "William", "James", "Acker"},
{{9,5,3,4,7,5,0,1,2,0,3}, "Aveline", "", "Axton"},
{{7,8,2,0,3,1,2,5,9,4,8}, "Harper", "Evelyn", "Brandon"}
};
display... |
C | #include <stdio.h>
int main()
{
int a, b;
int n1, n2;
scanf("%d %d", &a, &b);
n1 = (a % 10) * 100 + ((a % 100) / 10) * 10 + a / 100;
n2 = (b % 10) * 100 + ((b % 100) / 10) * 10 + b / 100;
if (n1 >= n2)
printf("%d", n1);
else
printf("%d", n2);
} |
C | #include <stdio.h>
#define BLOQUEADO 1
#define DESBLOQUEADO 0
/* Estrutura responsável por armazenar a Resposta que o resultado irá imprimir */
typedef struct tResposta
{
unsigned dado; /* irá manter o dado que foi testado na rede, diferente de 0 caso tenha um resultado */
unsigned divisor; /* caso o resultad... |
C | /*
* Program : time.c
* Author : Celso Martinho (celso@ua.pt)
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "logs.h"
#include "protos.h"
#include <defines.h>
#define FALSE 0
#define TRUE 1
time_t tx2date (char *date)
{
int day=0;
int month=0;
int... |
C | #include <stdio.h>
int main(int argc, char *argv[]){
char char_array[] = "abc"; // stores string
char *char_pointer = "abc"; //stores address to string
printf("Char array \"%s\" and Char pointer \"%s\"\n", char_array, char_pointer);
}
|
C | #include "RadixSort.h"
/*****************************************************
* ƣBucketSort
* ˵Ͱ()
* ˵
* أvoid
* ʱ䣺2018-8-26 Ѳ
* ݴ洢ֻ
* ˵O(n)
*****************************************************/
int BucketSort(void)
{
int book[1001], i, j, t, n;
for(i=0; i<=1000; i++)
book[i]=0;
printf("Ҫݵĸ(ݵֵ0,С1001)"... |
C |
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
/* typedef cause the compiler to add NewType to the list
* of type names that it recognizes. The NewType can be
* used in the same way as the built-in type. */
typedef int NewType;
/***********************************************************************... |
C | /*
filter: apply IIR/FIR filters using Direct Form II
copyright 2019 by the mpg123 project
licensed under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.org
initially written by Thomas Orgis
Since I spent a lot of time tuning filters for my resampler, I figured
I shou... |
C | #include <stdio.h>
#include <stdlib.h>
#include "tps_unit_test.h"
#include "append.h"
int __remaining_alloc;
int note;
void test_example_1(void)
{
__remaining_alloc = -1;
size_t size = 4;
int *tab = malloc(size*sizeof(int));
for(size_t i = 0; i < size; i++) tab[i] = i;
int ok = append(&tab, &size, 5);
t... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* set_flags_values.c :+: :+: :+: ... |
C | //#include "swap.h"
#include <stdio.h>
void main(void){
int m =1, n=9;
printf("Before swap: x=%d, y=%d \n", m, n);
swap(&m,&n);
printf("After swap : x=%d, y=%d \n", m, n);
}
|
C | #include <stdio.h>
#include <fonctio_a_tester.h>
#define TRUE 1
#define FALSE 0
//tester les fonction de types double
int test1(bool **principale, double **func) {
if (principale(func) == true)
{
return TRUE;
}
else
{
return FALSE;
}
}
//tester les fonction de types int
int ... |
C | /*
This was a tricky question for me.
I tried applying the logic of "GREEDY PUPPY" but time limit exceeded.
Since, the motive of this problem was to find the highest number of packages which will lead to maximum remainders.
So, we just need to find the divisor which gives the highest remainder.
This can be done by addi... |
C | #include <stdlib.h>
#include <stdio.h>
/*
* Tests that the padding of the middle structure does not depend on the largest alignment
* of the packed inner structure
*/
struct innerStruct {
double d;
int i1;
double d1;
int i2;
} __attribute__((packed));
struct middleStruct {
struct innerStruct st;
int i;... |
C | #include <string.h>
#include "alternate_case.h"
char* alternateCase(char* string)
{
for (unsigned i = 0; i < strlen(string); i++) {
if ((string[i] > 96) && (string[i] < 123))
string[i] = (char)(string[i] - 32);
else if ((string[i] > 64) && (string[i] < 91))
string[i] = (cha... |
C | #include "board.h"
#include "win.h"
void play_game(char** board, int turn){
const int size = 3;
while(!is_game_over()){
//display state of game to the user
print_board(board, size, size);
get_valid_move();
make_move();
//change the turn
turn = (turn + 1) % 2;
}
declare_winner();
}
int main(){
c... |
C | /*
* Simple LDAP Load Tester Example v0.1
* $Source$
* $Revision$
* $Date$
* $Author$
*/
/*
* ldapblaster.c - simple ldap load tester
*/
/*
* Software used in development:
* Sun Solaris 5.9
* Linux 2.4.21
* OpenLDAP 2.1.17
* GCC 2.95.3
*/
/*
* Related Links:
* http://www.openldap.org
*/
... |
C |
#include <xc.h>
#include <avr/iom32a.h>
#include <stdlib.h>
#include "USART.h"
void USART_init(char Mode, int BaudRate, char Operation, char TranmSpd, char CharSize, char Interrupt, char Polarity) {
// =========DEALING WITH UBRR=========
UBRRH &= ~(1 << URSEL);
int rate = (16000000 / 16 / ... |
C | #include<stdio.h>
#include<math.h>
int isPrime(int n)
{
int i;
for(i==2;i<=sqrt(n);i++)
if(n%i==0)
return 0;
return 1;
}
int Prime(int num1,int num2)
{
int i;
for(i=num1;num1<=num2;i++)
if(isPrime(i))
printf("%d",i);
}
void main()
{
int num1,num2;
printf("Enter the 2 numbers");
scanf("%d%d",&num1,&num... |
C | #include <stdio.h>
int main()
{
int a[] = {1,2,3,99,23};
int *ap, *bp;
ap = &a[2];
bp = ap + 1;
printf("%d\t%d\t%d\n", *ap, *ap+1, *bp);
return 0;
}
|
C | /*
** EPITECH PROJECT, 2018
** my_str_to_word_array
** File description:
** my_split_whites_spaces
*/
#include <stdlib.h>
static int alpha_num(char c)
{
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9'))
return (1);
else
return (0);
}
static int charword(c... |
C | //Already studied the 3 types of sorting so need to understand linear and binary search
#include<stdio.h>
#include<conio.h>
#include<climits>
void main(){
int array[100],n,i,search;
printf("\n Please enter the number of elements\n");
scanf("%d",&n);
printf("\n Now insert the values in the array\n");
for(i=0;i<n;i+... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <malloc.h>
#include <assert.h>
#include <pthread.h>
//create linked list
typedef struct node{
int num;
struct node *next;
int vacant;
}number;
typedef struct node2{
int num;
struct node2 *next;
int vacant;
}number2;
//allow for multi-arg
s... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
int make_sparse(int fdin, int fdout) {
static char const skipbyte = '\0';
// Read by one byte
char ch;
while(read(fdin, &ch, 1) > 0) {
if (ch == skipbyte) {
// If whence is SEEK_CUR, the offset is ... |
C |
typedef struct nodetag
{
int data;
struct nodetag *next;
struct nodetag *front;
}node;
node* addToEmpty(node **plast,int data)
{
// This function is only for empty list
if (*plast == NULL)
{
// Creating a node dynamically.
node *temp =
(node*)malloc... |
C | #include <windows.h>
#include <tchar.h>
#include <io.h>
#include <fcntl.h>
#include <stdio.h>
#define _CRT_SECURE_NO_WARNINGS
#define PIPE_NAME TEXT("\\\\.\\pipe\\teste")
#define PIPE_NAME_ACTUALIZA TEXT("\\\\.\\pipe\\teste2")
DWORD WINAPI ThreadActualiza(LPVOID param);
struct MSG{
int op;
int resultado;
TCHAR no... |
C | /*
* Read output of a single lane+mid case
*/
#include <db/db.h>
#include <hash/muttype.h>
#include <policy/rawgroup.h>
#include <policy/true.h>
#include <policy/heteroplasmy.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
FILE *f;
int rc;
sqlite3 *db;
mutations m, hm;
memset(&m,... |
C | //Alana Schwendler - M1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct a {
char nome[20];
int matricula;
} Aluno;
typedef struct p {
Aluno *primeiro;
Aluno *ultimo;
int quantidade;
} Pilha;
void push(Aluno *a, Pilha *p);
void pop(Pilha *p);
void clear(Pilha *p);
void reset(Pilha *p);
... |
C | /*
* Utkarsh Chanchlani : 11CS10049
* Sudarshan Maru : 11CS10028
* Threads Assignment
*/
/* Sample program demonstrating POSIX threads */
/* Topics covered:
(1) Thread creation, parameter passing, attribute setting, thread joining
(2) Using mutexes for critical sections
(3) Using condition variables for s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.