language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <string.h>
#include "sprite_extract.h"
#include "../globals.h"
/*-[ CONSTANTS AND MACROS ]---------------------------------------------------*/
#define VSWAP_FILE "VSWAP.ext" ///< File containing the sprites.
#define TRANSPARENCY 0xFF ///< Colour for transparent texels.
// Error ... |
C | /*
* Copyright (C) 2012 Trevor Woerner
* (see LICENSE file included in this repository)
*/
#include <stdio.h>
#include <stdlib.h>
int my_add (int a, int b);
int
main (int argc, char *argv[])
{
int a, b;
if (argc != 3) {
printf ("usage\n");
return 1;
}
a = atoi (argv[1]);
b = atoi (argv[2]);
printf (... |
C | #include "holberton.h"
void swap_int(int *a, int *b);
/**
* reverse_array - reverse the order of integers in an array
* @a: array of integers of any length
* @n: number of elements in the array
*
* Return: void
*/
void reverse_array(int *a, int n)
{
int i;
for (i = 0; i < n / 2; i++)
{
swap_int(&a[i], &a[n - i... |
C | #include "holberton.h"
/**
* onedigit - Short description, single line
* @i: Description of parameter x
* @j: Description of parameter x
* @n: Description of parameter x
* Return: Description of the returned value
*/
void onedigit(int i, int j, int n)
{
_putchar(i * j + '0');
if (j != n)
{
_putchar(',');
_put... |
C | #include "peripherals.h"
#include "osObjects.h"
#include "trace.h"
#include "stdio.h"
osThreadDef (thread1, osPriorityIdle, 300);
osThreadId tid_thread1;
extern int getCurrentCeiling();
int Init_thread1 (void)
{
tid_thread1 = osThreadCreate (osThread(thread1), NULL);
if (tid_thread1 == NULL... |
C | #include <gsl/gsl_linalg.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//Krance
#define xmax 5
#define xmin -5
//Prototypy
void wyznacz_M(double *xw, double *yx, gsl_vector *m, int n, double alfa, double beta);
double wyznacz_Sx(double *xw, double *yx, gsl_vector *m, int n, double x);
//Dan... |
C | #include <stdio.h>
void a(const char *const);
int main()
{
const char *const x = "Hello";
a(x);
return 0;
}
void a(const char *const x)
{
// OK
const char *const words[] = {"Hi", x, "Dog"};
// XXX: Warning: "Initalization discards const qaulifier from
// pointer target type"
char *const mo... |
C | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
int rand_init(void)
{
srand(time(NULL));
return rand() % 10 +1;
}
void while_test(int num)
{
int cnt = 0;
while(num--)
{
cnt++;
}
printf("cnt = %d\n",cnt);
}
void find_even(int num)
{
int cnt = 1;
while(cnt <= num)
{
if(!(cnt % 2))
{
printf(... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
void shift_cipher(char *, char);
void read_file(), write_file(char);
FILE *filePtr;
#define MAX 1000 // max size of data
char letters[27]="abcdefghijklmnopqrstuvwxyz ", fname[100];;
void main() {
char data[MAX];
int option, ch;
puts("e - encrypt")... |
C | #include <stdio.h>
int main(){
int casos,conta;
int a,b,c,e,f;
int config[100][2];
c = 0;
scanf("%d",&casos);
int numeros[casos][200];
while(c!=casos){
a = 0;
scanf("%d %d",&config[c][0],&config[c][1]);
while(a != config[c][1]){
scanf("%d",&numeros[c][a]);
a++;
}
c++;
}... |
C | #include <stdio.h>
void print_arr(int *arr, int size)
{
int i;
i = 0;
while(i != size)
{
printf("[%i]", arr[i]);
i++;
}
printf("\n");
}
// each with each
/*void sort_int_tab(int *tab, unsigned int size)
{
int tmp;
unsigned int i;
unsigned int j;
i = 0;
while (i < size - 1)
{
j = i;
while (j... |
C | /**
This program returns 1 to 999 in Japanese Romaji.
Returns it through a combo of for and switch statements.
@author Saito, SaitoShin07
@assignement ICS 212 Assignment 7
@date 2021 - 02 - 11
*/
#include <stdio.h>
int main(void) {
//variable declaration
//how high the program will count up to
int i = 1;
//i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <signal.h>
#include <netdb.h>
#define SERVER_PORT_A 21143
#define SERVER_PORT_B 22143
#def... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main ()
{
size_t sizel = 700000000;
char * begin = (char *)malloc(sizel);
if(begin == NULL){
printf("error : malloc failed");
}
pid_t fpid; //fpid表示fork函数返回的值
int count=0,i = 0;
fpid=for... |
C | /*=============================================================================
* Author: Fernando Prokopiuk <fernandoprokopiuk@gmail.com>
* Date: 2021/09/02
*===========================================================================*/
/*=====[Definition macros of private constants]==============================*/... |
C | /*
You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1.
Example 1:
coins = [1, 2, 5], amount = 11
return 3 (11... |
C | #include <sys/utsname.h>
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include "../error-handle.h"
int main(int argc, char *argv[])
{
struct utsname buf;
struct tm *pt = NULL;
time_t t = 0;
char buff[128] = { 0 };
if (uname(&buf) < 0) {
err_exit("uname failed!\n");
}
printf("sysname--%s\n", b... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include "../include/process.h"
#include "../include/mutex.h"
#include "../../common/include/utils.h"
#include "../../common/include/error.h"
#include "../../common/include/const.h"
#include "../../common/include/socket... |
C | #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
typedef struct node node;
typedef struct queue queue;
struct node {
int data;
node* next;
};
struct queue {
node* head;
node* tail;
};
queue* push(queue* q, int data) {
node* temp = malloc(sizeof(node));
if (temp == NULL) {
... |
C | //WAP in C to generate the Fibonacci series using recursive Function.
#include<stdio.h>
int fibo(int);
int main(){
int x,n,i=0,c;
printf("Enter your number: ");
scanf("%d",&n);
for (c=1;c<=n;c++){
printf("%d\t",fibo(i));
i++;
}
return 0;
}
int fibo(int n)
{
if(n==0){
retur... |
C | #include <stdio.h>
/* Question 8.a
* Rewrite it using no goto & breaks statement
* @uthor: Ernest Mujambere
* Class: Programming Language Concept -> Spring 2020
*/
int main() {
int j = -3;
int i;
for(i = 0; i < 3; i++){
int k = j + 2;
if(k == 3){
// Nothing
}
if(k == 2){
//... |
C | #include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sudoku3/ftype.h>
static ushort_t _s;
static f_t* _nums;
static f_t* _complements;
__attribute__((constructor))
static void _init() {
long s = sizeof(f_t) * 8;
_nums = malloc(sizeof(f_t) * s);
_c... |
C | #include <stdio.h>
int soma(int* v,int n){
if(n==0){
return 0;
}
return v[0] + soma(&v[1],n-1);
}
int soma2(int* v,int n){
if(n==0){
return 0;
}
return v[n-1] + soma(v,n-1);
}
int soma3(int* v, int n){
return v[n]+soma3(v,n-1);
}
int main(void){
int v[] = {1,3,4,2,6,5};
printf("Soma de v = %d\n",soma(... |
C | /*****************************************************************/
/* Class: Computer Programming, Fall 2019 */
/* Author: 胡紹宇 */
/* ID: 108820008 */
/* Date: 2019.11.27 ... |
C | int main()
{
char dna[256];
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%s",&dna);
for(int j=0;;j++)
{
if(dna[j]=='A') printf("T");
else if(dna[j]=='T') printf("A");
else if(dna[j]=='G') printf("C");
else if(dna[j]=='C') printf("G");
else if(dna[j]=='\0') break;
}
... |
C | #include <stdio.h>
#include <string.h>
int main() {
char s[100], r[100];
int i;
printf("Enter a string:\n");
gets(s);
int end = strlen(s);
int n = end;
for (i = 0; i < n; i++) {
r[i] = s[end - 1];
end--;
}
r[i] = '\0';
printf("%s\n", r);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h> //srand está nessa biblioteca
#include <locale.h>
#include <string.h>
#include <time.h> //time está nessa biblioteca
#include "Jogo_da_Forca_.h"
//variáveis globais
char palavra[TAM_PALAVRA]; // Vai ser a palavra escolhida pelo programa
char letrasTotal[26]; //letrasTotal[] ... |
C | #include <stdio.h>
int main()
{
int arr[3][4] = { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12} };
int i = 1,j = 2;
printf("\n arr = %p",arr);
printf("\n *arr = %p",*arr);
printf("\n (arr+i) = %p",(arr+i));
printf("\n *(arr+i) = %p",*(arr+i));
printf("\n *(arr+i)+j = %p",*(... |
C | #include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
int main()
{
printf("\nCollatz Conjecture \n");
int num;
int process;
printf("Enter a number greater than 0 to run the Collatz Conjecture.\n");
scanf("%d", &num);
if (num <0){
printf("This number ... |
C | // Ilias Mastoras 05/08/2018
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/p... |
C | // Implements a dictionary's functionality
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dictionary.h"
//Define node structure with word and pointer to next node
typedef struct node
{
char word[LENGTH + 1];
struct node *next;
}
node;
//Default h... |
C | // simple shell example using fork() and execlp()
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#define CMD "ps"
int main(void)
{
pid_t k;
char buf[100];
int status;
int len;
int fd;
int cfd;
char cbuf[500];
// client create the cfifopid
c... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main() {
int rand;
if ((rand = open("/dev/random", O_RDONLY)) < 0) {
printf("ne nashel");
exit(1);
}
else {
char string[20];
ssize_t result = read(rand, string, sizeof(string));
... |
C | #include <pebble.h>
static Window *window;
static Layer *window_layer;
static TextLayer *text_layer;
static ScrollLayer *s_scroll_layer;
static TextLayer *s_text_layer;
static GBitmap *s_bitmap;
static BitmapLayer *s_bitmap_layer;
#define apidata 0
static void inbox_received_callback(DictionaryIterator *iterator, v... |
C | /*
putchar is the only external dependency for this file,
if you have a working putchar, leave it commented out.
If not, uncomment the define below and
replace outbyte(c) by your own function call.
*/
#define putchar(c) outbyte(c)
#include <stdarg.h> /* va_list, va_arg() */
#include "do_printf.h"
/*************... |
C | #include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
int main (int argc, char** argv){
int device = -1;
//open device
device = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NONBLOCK);
if (device == -1){
printf("Failed to op... |
C | #include "headerfiles.h"
void bg(char *cmd,struct Job JOBS[100], int numchild)
{
char *tok = strtok(cmd," ");
tok = strtok(NULL," ");
int jobnum = atoi(tok),jobid;
int present = 0;
for(int c = 0 ; c < numchild ; c++ )
{
if(JOBS[c].jobnumber == jobnum && JOBS[c].terminated == 0)
... |
C | // This is very simple input generator.
// A separate process generates input at 1 second
// time intervals. Input is characters A B C, ..., Z.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include<fcntl.h>
#include <errno.h>
#include <sys/time.h>
int OpenChatFellow() {
pid_t ... |
C | #include <stdio.h>
#include <stdlib.h>
#include "vector.c"
#include "LinkedList.c"
#include "Stack.c"
#include "Queue.c"
int main()
{
///////////////////////////////PART I//////////////////////////////////////////////////////
///////////////////////////////////////PART A/////////////////////////////////////////////////... |
C | // to find the difference between the sum of nodes at odd level and nodes at even level
#include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
node* left;
node* right;
};
void insert(node** root,int key)
{
if((*root)==NULL)
{
(*root)=(struct node*)malloc(sizeof(struct node));
(*root)->data=key;
... |
C | #include"stdio.h"
struct date
{
int nam;
int thang;
int ngay;
char thu[4];
}d;
main()
{
int kich_thuoc;
kich_thuoc=sizeof(struct date);
printf("\n- Kich thuoc cau truc date la:%d bytes",kich_thuoc);
kich_thuoc=sizeof d;
printf("\n- Kich thuoc cua bien cau truc d la:%d bytes",kich_thuoc);
getch();... |
C | //
// Created by lugi1 on 2018-07-05.
//
#include "Hitbox.h"
#include <malloc.h>
#include <stdio.h>
#include <math.h>
#include <Vector.h>
#include <Hitbox.h>
#include "Hitbox.h"
#include "Vector.h"
#include "JamError.h"
/* The following functions mostly break the "don't use a return
* statement anywhe... |
C | #include "stack.h"
struct stack stack_init()
{
struct stack s;
s.elem = malloc(2* sizeof(int));
s.capacity =2;
s.size = 0;
return s;
}
//扩容
static void expand(struct stack *s)
{
if(s->size < s->capacity) return; //尚未满员,不必扩容
s->elem = realloc(s->elem,(s->capacity<<=1)*sizeof(int));
}
void ... |
C | /*
* ls.c
*
* Created on: 20 août 2008
* Author: drossier
*/
#include <stdio.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* Forking process for each dir...
*/
int main(int argc, char **argv) {
DIR *stream;
struct dirent *p_entry;
char *dir;
if (argc == 1) {
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include "util.h"
#include "generic_ipc.h"
#define MAX_SEND_CNT 100
#define SEND_INTERVAL 1 //seconds
#define IPC_MSG_MAX_LEN 255
static void
client_hander (ipc_req_t *req_p, ipc_resp_t *resp_p)
{
pid_t pid;
... |
C | #ifndef ESTRUCTURAS_H
#define ESTRUCTURAS_H
//CONSIDERACION: Se utilizaron estructuras usadas en el laboratorio anterior.
/*
* Descripcion: Estructura que almacena los elementos relacionados al forwarding tales como
* su posicion, numero de instruccion, cual registro esta involucrado, y si posee multiple forward.
... |
C | /*
** cmd_parsing.c for myirc in /home/ganesha/projets/Myirc/client_dir
**
** Made by Ambroise Coutarel
** Login <ganesha@epitech.net>
**
** Started on Thu Apr 9 20:33:21 2015 Ambroise Coutarel
** Last update Sun Apr 12 13:41:15 2015 Ambroise Coutarel
*/
#include "irc_client.h"
t_client_com g_commands_client[3];
... |
C | #include <stdio.h>
#include <limits.h>
#include <float.h>
#include <math.h>
/* it is really important to select the appropriate format specifiers */
int main() {
printf("####################### limits.h ########################\n");
printf("CHAR_BIT:\t%d\t%d\n", CHAR_BIT, 8); ... |
C | #include<stdio.h>
int main(){
int days;
//7 days = 1 week
//30 days - 1 month
//365 days - 1 year
printf("Enter days:");
scanf("%d", &days);
int year1 = days/365;
int year2 = days%365;
int month1 = days/30;
int month2 = days%30;
int week1 = days/7;
int week2 = days%7;
//i want to present the l... |
C | #include "quaternion.h"
#include <math.h>
struct Quaternion convVecToQuat(struct Vector vec)
{
struct Quaternion quat = {0, vec.x, vec.y, vec.z};
return quat;
}
struct Quaternion quatForRot(struct Vector axis, float angle)
{
float halfAngle = angle / 2.0f;
float sinHalfAngle = sinf(halfAngle);
struct Quaternion... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_unset.c :+: :+: :+: ... |
C | bool isPowerOfThree(int n) {
if(n<=0) return false;
while((n%9) == 0)n/=9;
if(n%3==0) n/=3;
return !(n-1);
} |
C | #include "marla.h"
const char* marla_getDefaultStatusLine(int statusCode)
{
const char* statusLine;
switch(statusCode) {
case 100:
statusLine = "Continue";
break;
case 101:
statusLine = "Switching Protocols";
break;
case 200:
statusLine = "OK";
break;... |
C | /*
* A D D _ P T R
*
* Demonstrate declaration and use of pointers.
*/
#include <stdio.h>
int main(void) {
int number1, number2, sum; /* declare variable names */
int *np1, *np2, *sp; /* declare pointers */
/*
* Load pointers with addresses of the declared variables.
*/... |
C | //
// Created by zf on 2018/4/28.
// 数组栈问题 数组大小固定 满了就无法压栈 ,出栈也不会释放空间
// 可以用realloc 重新分配空间但是麻烦
// realloc函数用于修改一个原先已经分配的内存块的大小,
// 可以使一块内存的扩大或缩小。当起始空间的地址为空,即*ptr = NULL,则同malloc
#ifndef C1_ARRAYSTACK_H
#define C1_ARRAYSTACK_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define MAX_... |
C | #include "max6675.h"
#include "spi.h"
/**
* @brief max66675ģʼ
* @param None
* @retval None
*/
void max6675_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(MAX6675_CS1_CLK, ENABLE); //PORTAʱʹ
GPIO_InitStructure.GPIO_Pin = MAX6675_CS1_PIN; // PA4 T_CS
GP... |
C | #include <stdio.h>
#include <stdlib.h>
#define N 1000001
void selectionSort(char *);
int main(){
char ch;
char * vetor = (char *)malloc(sizeof(char)*N);
int i = 0;
while(scanf("%s", vetor) != EOF){
selectionSort(vetor);
printf("%s\n", vetor);
}
return 0;
}
void sel... |
C | //2. Upper Triangular Matrix
#include <stdio.h>
int main()
{
float a[3][3];
int i,j,k;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%f",&a[i][j]);
}}
for(i=1;i<3;i++)
{
for(j=0;j<3;j++)
{
float pivot = - (a[i][j] / a[j][i]);
for(k=0;k<3;k++)
{
a[i][k] = a[i][k] + (a[j][k] * pivot);
}
}}
for(i=0;i<3;i++)
{
printf... |
C | /**
* @file queue.c
* @author Aviad Dudkevich
*
* @brief Implementation of a queue data structure.
*/
#include "queue.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
/**
* @brief Initiate an queue.
* @param elementSize - the size of the data in all the nodes.
* @return a pinter to the queue.
*/... |
C | #include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <unistd.h>
#include "util.h"
void
Error(const char * error) {
perror(error);
exit(EXIT_FAILURE);
}
// Función de utilidad, para generar los tiempos usados por los aviones
// Devuelve un número aleatorio comprendido entre min y max
double randRang... |
C | #pragma once
#include "HashTable.h"
#include <string.h>
typedef struct SpellingSuggestion SpellingSuggestion;
struct SpellingSuggestion {
char* originalWord;
LinkedList * suggestions;
SpellingSuggestion* next;
};
int wordSpellingChecker(HashTable* dictionaryTable);
int isWordInDictionary(HashTable* ... |
C | #include <stdio.h>
#define MAX_NUM 100000
#define MIN_VAL -1000
int max(int a, int b);
int maxCSum(int *arr, int n);
int main() {
int arr[MAX_NUM];
int N;
scanf("%d", &N);
for (int i = 0; i < N; i++)
scanf("%d", &arr[i]);
printf("%d\n", maxCSum(arr, N));
return 0;
}
int max(int a... |
C | #include <stdio.h>
int main()
{
int i, j;
int x, y;
scanf("%d %d", &x, &y);
i=1;
while(i <= y){
for(j=0;j<x;j++){
printf("%d",i);
i++;
if(j != x-1) printf(" ");
}
printf("\n");
}
return 0;
}
|
C | /*=============================================================================
* Author: Marcos Dominguez <mrds0690@gmail.com>
* Date: 2021/10/08
* Version: 0.0.1
*===========================================================================*/
/*=====[Inclusions of function dependencies]============================... |
C | #include <stdio.h>
int main(void) {
int i, j, temp;
int arr[10] = { 1,10,5,8,7,6,4,3,2,9 };
for (i = 0; i < 9; i++) {
j = i;
// ش Ұ Һ ũٸ, ٲش. , ε ҽѰ Ѵ.
// Ǿ ִٸ while ʱ ĵ ȿ̴.
while (arr[j] > arr[j + 1]) {
temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
j--;
}
}
//־ ( ϳ Ǿ ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int32_t main(void)
{
int32_t *ptr = (int32_t *)calloc(10,sizeof(int32_t));
// int32_t *ptr = (int32_t *)aligned_alloc(sizeof(int32_t),10*sizeof(int32_t));
if (NULL == ptr){
perror("perror calloc()");
return -1;
}
ptr[0] = 1; ... |
C | /*
** my_isnum.c for asm-corewar in /home/emad_n//ASM-Corewar/src/lib
**
** Made by navid emad
** Login <emad_n@epitech.net>
**
** Started on Sun Feb 24 01:40:46 2013 navid emad
** Last update Sun Feb 24 16:58:59 2013 navid emad
*/
int my_isnum(char ch)
{
return ((ch >= '0' && ch <= '9') ? 1 : 0);
}
int my_isnum... |
C | #include<stdio.h>
int main()
{
int money1,money2;
printf("Enter money gave to saurav = ");
scanf("%d",&money1);
printf("Enter money gave to sajal = ");
scanf("%d",&money2);
money1 += money2;
money2 = money1 - money2;
money1 -= money2;
printf("Money on saurav = %d\nMoney on sajal = %d",money1,money2);
return 0... |
C | #ifndef ARITHTYPE
// define this to a number between 0 and 4
#define ARITHTYPE 4
#endif
#if ARITHTYPE == 0
typedef signed char mysint;
typedef unsigned char myuint;
#elif ARITHTYPE == 1
typedef short mysint;
typedef unsigned short myuint;
#elif ARITHTYPE == 2
typedef int mysint;
typedef unsigned int myuint;
#elif ARIT... |
C | /*
* Author: Sword Lord of The Lonely Peak
* Date: 2020/05/18
* Program Name: Linked List Practice!
*/
/**************************************************************************************************************************************/
#include<stdlib.h>
#include<stdio.h>
typedef struct Node {
int data;
... |
C | #include <stdio.h>
/*
*This programe is demonstrated bell and so on
*/
int main ( void )
{
printf("Hello world!\r");
// Herizontal tab
printf("水平制表符\t");
printf("after herizontal tab\n");
printf("\a");
//vertical tab
printf("垂直制表符\v");
printf("vertical tab\n");
/*
*The text output:(where is the "Hello Wor... |
C | /* hundscvt.f -- translated by f2c (version 19970219). */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "calpgm.h"
int main(argc, argv)
int argc;
char *argv[];
{
#define NFNAM 36
static int icv[4] = {1,2,4,0};
static char infil[NFNAM], outfil[NFNAM], work[82], fmt[5];
FILE *l... |
C | #include <stdio.h>
#include <stdlib.h>
int encaixa(int a, int b){
int cont = 0;
int auxA = a, auxB = b;
int casas_dec;
while(b!=0){
cont++;
b = b/10;
}
casas_dec = pow(10,cont);
if((auxA%casas_dec) == auxB)
return 1;
else
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_draw_line.c :+: :+: :+: ... |
C | #include<avr/io.h>
#include<util/delay.h>
#include<compat/deprecated.h>
#include<ilcd.h>
#define s1_clr bit_is_clear(PIND,0)
#define s2_clr bit_is_clear(PIND,1)
#define s3_clr bit_is_clear(PIND,2)
#define s4_clr bit_is_clear(PIND,3)
#define s1_set bit_is_set(PIND,0)
#define s2_set bit_is_set(PIND,1)
#define s... |
C | #include <msp430.h>
#include "main.h"
#include "hal_LCD.h"
volatile unsigned char * S1buttonDebounce = &BAKMEM2_L; // S1 button debounce flag
volatile unsigned char * S2buttonDebounce = &BAKMEM2_H; // S2 button debounce flag
void Init_GPIO(void);
/**
* main.c
*/
int main(void)
{
Init_L... |
C | // Ҫǵ
// һ, Կǵ. һַܴ, ת int ܳ int ıʾΧ
int MyAtoi(const char* str) {
int flag = 1; //
int ret = 0; // ս
if (str == NULL || *str == '\0') {
return 0;
}
// 1. հַ(ո, , س, Ʊ, ֱƱ, ҳ...)
while (isspace(*str)) {
str++;
}
// 2. + - ŵ
if (*str == '-') {
flag = -1;
str++;
}
if (*str == '+') {
str++;
}
/... |
C | #include<stdio.h>
int main(void) {
int input, on, sn;
on = sn = 0;
float s_sum, s_ave, o_sum, o_ave;
printf("Please enter some numbers:\n");
scanf("%d", &input);
while (input != 0) {
if ((input % 2)) {
sn++;
s_sum += input;
} else {
on++;
... |
C | void puth(unsigned int i);
void puts(const char *a);
void dac_init(void) {
// no buffers required since we have an opamp
//DAC->CR = DAC_CR_EN1 | DAC_CR_BOFF1 | DAC_CR_EN2 | DAC_CR_BOFF2;
DAC->DHR12R1 = 0;
DAC->DHR12R2 = 0;
DAC->CR = DAC_CR_EN1 | DAC_CR_EN2;
}
void dac_set(int channel, uint32_t value) {
i... |
C | #include <stdio.h>
int main()
{
int l, r ;
while ( scanf("%d%d", &l, &r) , !(l == 0 && r == 0))
printf("%d\n", l + r);
return 0;
}
|
C | /*
Víctor Manuel Cavero Gracia - DNI: 45355080T
Iván Fernández Sánchez - DNI: 52902115E
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int my_system(int args, char* argc[])
{
for(int i = 1; i < args; i++)
{
printf("Ejecutando comando: %s\n", argc[i]);
system(argc[i]);
print... |
C | /* a program that tests whether two words are anagrams */
#include <stdio.h>
#include <ctype.h>
#define TRUE 1
#define FALSE 0
/* 26 indexes are corresponding to 26 letters of the alphabet. */
void read_word(int counts[26]);
int equal_array(int counts1[26], int counts2[26]);
int main(void)
{
int firs... |
C | #include "euler.h"
/*
* Find the best generator of primes g(n) = n^2+an+b where
* |a| < 1000 and |b| < 1000.
*
* Clearly, b has to be at least 2, otherwise g(0) is not prime.
*
* Also, 1+a+b >= 2 (since g(1) is prime), so a >= 1-b.
*
* Also, g(b) is not prime, so the sequence can't be longer
* than 1000, so w... |
C | /*
* test_gcc.c
* Copyright (C) 2015 jujian <jujian@diandong.com>
*
* Distributed under terms of the MIT license.
*/
#include <stdio.h>
int main() {
printf("a=%d, b=%d, c=%d", 1, 2, 3);
return 0;
}
|
C | #include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define SIZE 20
void Intercambiar_Arrays(uint8_t a[], uint8_t b[]);
void main()
{
uint8_t A[SIZE];
uint8_t B[SIZE];
printf("Nombre 1: ");
gets(A);
printf("\nNombre 2: ");
gets(B);
Intercambiar_Arrays(A,B);
}
void Intercambiar_Arrays(uint8_t a... |
C | #include<stdio.h>
#include<stdlib.h>
#include "../data_structures/heapSort.c"
int lcm(int* ar, int m);
int lcm(int* ar, int m) {
int res = ar[0];
int a,b;
for(int i=1; i<m; i++) {
if(res>ar[i]) {
b= res;
a= ar[i];
}
else {
b = ar[i];
a = res;
}
int r=1;
while(r>0) {
r... |
C | #include <stdio.h>
int main()
{
struct student
{
char name[30];
int rollno;
float mark1, mark2, mark3, mark4, mark5;
float avg;
};
struct student s1;
printf("enter the student's name :- ");
scanf("%s", &s1.name);
printf("enter the rollno of the student :- ");
scanf("%d", &s1.rollno);
... |
C | /*
* =====================================================================================
*
* Filename: tcputil.c
*
* Description:
*
* Version: 1.0
* Created: 11/02/2013 07:17:02 AM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organizati... |
C |
/*
* RITHMOMACHIE - Created by Anderson5091 23/Avril/17.
* - Fin de creation de prise par blocage 24/Avril/2017.
* - Debut de creation de prise par arithmetique 27/Avril/2017.
* ce module peremet de gerer l'ensemble de tous les prise possible
* en prenant en comp... |
C | /*
Inject DLL ini ke dalam proses.
Pembacaan dan penulisan wilayah memory tertentu akan terjadi. Dalam kasus ini,
nilai variabel global akan dimodifikasi.
Sesuaikan alamat variabel global sebelum melakukan kompilasi!!
Compile:
[gcc]
(x64)
$ gcc -m64 -shared payload.c -o payload.dll
(x86)
$ gcc -m32 -shar... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX 50
#define ENCAD 10
int lePrecos(int arr[], float mat[][5]) {
char tipo;
int i=0;
float p0, p1, p2, p3, p4;
FILE *precos;
precos = fopen("ENCADERNACAO.TXT", "r");
if (precos == NULL) {
printf("\n\nERRO AO ABRIR ARQUIVO DE PRECOS DE ENCADERNACAO\n\n");
exit(... |
C | #include<stdio.h>
int fibonacci(int n);
int main()
{
int n;
printf("Enter n : ");
scanf("%d", &n);
printf("Fibonacci : %d",fibonacci(n));
return 0;
}
int fibonacci(int n)
{
int sum, prev, next;
sum = 0;
prev = 1;
next = 1;
if(n == 1)
{
return sum;
}
else if(... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
int fd;
if(argc != 2){
printf(1, "Usage: filestat [filepath]\n");
exit();
}
struct stat st;
if((fd = open(argv[1], 0)) < 0){
printf(1, "cat: cannot open %s\n", argv[1]);
exit();
}
if(fstat(fd,... |
C | #ifndef _STRING_FUNCTION_H
#define _STRING_FUNCTION_H
int Index(String s, String t, int pos){
// 如果在s的pos下标之后有t子串,返回第一个下标
String sub;
InitString(sub);
if(pos > 0){
int n = StrLength(s);
int m = StrLength(t);
int i = pos;
while(i <= n - m + 1){
SubString(sub... |
C | #include <stdio.h>
void smile(int n)
{
while(n>=1){printf("smile!");n--;}
printf("\n");
}
int main(void)
{
int n;
printf("input a number : ");
scanf("%d",&n);
while(n)
{
smile(n);
n--;
}
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* redir.c :+: :+: :+: ... |
C | #include "../inc/pathfinder.h"
static void mx_recursion(t_path **list, char ***pathes, int i, int j, char *str) {
char *tmp = mx_strdup(str);
char **arr = mx_strsplit(pathes[i][j], ',');
int k = 0;
str = mx_strcat_del(tmp, mx_itoa(j), ",");
while (arr[k] != NULL) {
if (mx_strcmp(arr[k], ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
// main fnc
int main(void)
{
// data accessed from module2.c and module3.c
extern int a[4096];
extern int b[32];
extern long* c;
extern long* d;
extern void* mainPtr;
extern long* pointerToSharedMemory;
exte... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct book{
int bookid;
char title[20];
float price;
};
int main(){
struct book b;
FILE *fp;
fp=fopen("f2.dat","wb");
printf("Enter bookid, title and price: ");
scanf("%d",&b.bookid);
fflush(stdin);
gets(b.title);
scanf... |
C | #pragma warning(disable:4996)
#include <stdio.h>
#include <time.h>
int main(void)
{
struct tm t1, t2, t3;
time_t n1, n2, n3;
t1.tm_year = 2020 - 1900;
t1.tm_mon = 6 - 1;
t1.tm_mday = 23;
t1.tm_hour = 1;
t1.tm_min = 12;
t1.tm_sec = 50;
t2.tm_year = 2020 - 1900;
t2.tm_mon = 8 - 1;
t2.tm_mday = 19;
t2.tm_h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.