language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* Tamir Moshiashvili
* 316131259
* 89-231-03
* EX3
*/
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <memory.h>
#define SHM_SIZE 4096
// strings
#define FIFO "fif... |
C | #include "mystery.h"
int num[200];
int add (int a, int b){
return a + b;
}
int dothething(int n){
if (n == 1 || n == 2){
return 1;
}else{
return add(dothething(n-1), dothething(n-2));
}
}
int main(int argc,char** argv){
int tmp = atoi(argv[1]);
int result;
if(tmp==0){
result=0;
}else if(tmp<0){
printf("In... |
C | /*
** EPITECH PROJECT, 2017
** test
** File description:
** test
*/
#include <criterion/criterion.h>
#include <criterion/redirect.h>
#include "header_tetris.h"
Test(print_shape, test1)
{
char *shape[] = {"**", "*", "**", NULL};
tetrimino_t tetri = {"flo", 2, 3, 4, shape, true};
char str[] = "Tetriminos : Name flo... |
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 "header.h"
int main()
{
int menuOption = mainMenu();
int x, y, currentGen = 1;
cel **table;
switch(menuOption) {
case 0:
printf("\n\n--Novo Jogo--\n\n");
printf("Tamanho do mundo (x y): ");
scanf("%d %d", &x, &y);
table = defineTable(x, y);
... |
C | // program to test forever loop
#include<stdio.h>
int main (void)
{
int counter = 0;
while(0==0)
{
printf("%i",counter);
counter++;
}
}
|
C | /******************************************************************************
* MSP-EXP430G2-LaunchPad Software UART Transmission
*
* Original Code: From MSP-EXP430G2-LaunchPad User Experience Application
* Original Author: Texas Instruments
*
* Description: This code shows the minimum neeed to send data over a softw... |
C | /**
* @file include/mcube/list.h
*
* @author Hiroyuki Chishiro
*/
#ifndef __MCUBE_MCUBE_LIST_H__
#define __MCUBE_MCUBE_LIST_H__
/*
* Type-generic doubly-linked lists
*
* Copyright (C) 2010 Ahmed S. Darwish <darwish.07@gmail.com>
*
* This API is very close to the Linux-2.6 one, which I've used back in
* the da... |
C | #include "utility.h"
#include "../../core/util/log.h"
#include "types.h"
void extract_signture(bytes_t i_raw_sig, uint8_t* o_sig) {
//ECDSA signature encoded as TLV: 30 L 02 Lr r 02 Ls s
int lr = i_raw_sig.data[3];
int ls = i_raw_sig.data[lr + 5];
int offset = 0;
in3_log_debug("lr %d, ls %d \n", lr... |
C | /*
* 分配、设置、注册一个 platfrom_driver 结构体
* 这边的程序不用改变
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/sched.h>
#include <linux/pm.h>
#include <linux/slab.h>
#include <linux/sysctl.h>
#include <linux/pro... |
C | #include <stdio.h>
#include"servolib.h" //This is the Modular Servo Library we are using to control Servo Movement
void drive_to_botguy(){};
void drive_to_scoring_area(){};
int main()
{
servo arm = build_servo(1, 0, 2048);
//Build a 'servo' named 'arm'
//It is in Port #1, Its Minimum Position is 0, Its Maximum P... |
C | /*
Meno:
Datum:
Simulujte nasledujucu situaciu. V malom kralovstve korunovali noveho krala a chodia sa mu neustale klanat styria slachtici a desiati poddani. Prejavovanie ucty kralovi trva nejaky cas (v simulacii 1s) a nejaky cas si slahctic ci poddany dava prestavku (v simulacii 4s). Cela simulacia nech trva 30s.
1.... |
C | /*
Pedro Diógenes
Alefe Lucas
Bernardo Morais
Foi alterado a entrada para N = 90000
para ter um tempo mais amplo e poder
medir melhor o speedup.
Tempo sequencial:
real 0m21,744s
user 0m21,740s
sys 0m0,004s
Tempo paralelo com politica default:
real 0m12,236s
user 0m22,645s
sys 0m0,000s
Tempo paralelo com polític... |
C | /****************************************************************************
* hexdump - a program to display a file in hexadecimal and ascii
* Such as:
* 000020: 19 00 00 00 48 00 00 00 5F 5F 50 41 47 45 5A 45 | ....H...__PAGEZE
*
* Author: Robert Bierman
* Date: March 28, 2020
* Source: hexdump.c
*
* ... |
C | #include <R.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
void cartgini(int *fn, int *fp, int *groups,double *fvals,int *group, int *ngroup,double *val);
void cartentropy(int *fn, int *fp, int *groups,double *fvals,int *group, int *ngroup,double *val);
void z... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include "commands.h"
#define SHELL_RL_SIZE 1024
#define SHELL_TOK_SIZE 64
#define SHELL_TOK_DELIM "\t\r\n\a"
char *shell_read_line(void);
char **shell_split_line(char *line);
int shell_launch(char **args);
int shell_... |
C | #include <myLinux.h>
void *thr_fn(void *arg)
{
int n = 3;
while (n--) {
printf("thread count %d\n", n);
sleep(1);
}
return (void *) 1;
}
int main(int argc, char *argv[])
{
pthread_t tid;
void *tret;
int err;
pthread_create(&tid, NULL, thr_fn, NULL);
... |
C | #include <stdio.h>
void display();
int main()
{
int iRange = 0;
printf("Enter any Number to print pattern on the console :""\n");
scanf("%d",&iRange);
display(iRange);
return 0;
}
void display(int iCount)
{
int iRow=0;
int iLimit=1;
printf("\n");
continu:
for(iRow=1; iRow <= iCount;iRow++)
{
... |
C | //
// Created by tangwan on 2019-09-16.
//
/**
* @desc: 7-8 哈利·波特的考试
* @author tangwan
* @date 2019-09-16
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define MaxVertexNum 100 /* 最大顶点数设为100 */
#define INFINITY 65535 /* ∞设为双字节无符号整数的最大值65535*/
typedef int Vertex; /* 用顶点下标表示顶点,为整型 */
typedef i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include "ilist.h"
#include "hashtable_ed.h"
int main(int argc, char** argv){
int n, m, i, chave;
int seed = 0;
n = argc > 1 ? atoi(argv[1]) : 10;
m = argc > 2 ? atoi(argv[2]) : n >> 1;
srand(seed);
THED* ht;
ILIST *cha... |
C | /**
* @file buf.h
*
* Defines structures and functions for working with byte arrays of arbitrary
* length. These are mostly used in the serialisation and deserialisation of
* messages between the client and Diffusion, but are useful in a range of
* other situations.
*
* Copyright © 2014, 2015 Push Technology Lt... |
C | #include "holberton.h"
void handle_error(char *comm, int _stat);
int print_number(int n);
void print_environ(void);
/**
* str_process - Process and executes a command
* @command: Command to execute
* @b_r: Count of bytes inside commnad parameter
* @c: Count of the command
*
* Return: Null pointers
*/
char **str... |
C | // There are a row of n houses, each house can be painted with one of the three colors: red, blue or green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color.
//
// The cost of painting each house with a certain colo... |
C | int x = 0;
int y=10;
void f(int a, int b){
while(b<a){
a = a - 1;
x = x + 1;
}
}
int main(){
int a = 20;
int b = 5;
if(b<a)
f(a,b);
else
if(b>a)
return 1;
else
return 2;
if(x < 10){
if(a<y)
return 3;
... |
C | #include<stdio.h>
int main()
{
int n,r,q,arr[10];
scanf("%d",&n);
int count=0;
while(n!=0)
{
arr[count++]=n%2;
n=n/2;
}
for(r=count-1;r>=0;r--)
{
printf("%d",arr[r]);
}
return 0;
}
|
C | /*
* utn.c
*
* Created on: 15 sep. 2020
* Author: nico
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static int esNumerica (char *cadena)
{
int retorno = -1;
int i = 0;
if (cadena[0] == '-')
{
i = 0;
}
for (; cadena[i] != '\0'; i++)
{
if (cadena[i] > ... |
C | #include <xc.h>
#include <plib/i2c.h>
#include "rtc.h"
// DS1307 address: 1101000 = 0xD0
#define DS1307_ADDRESS_READ 0xD1
#define DS1307_ADDRESS_WRITE 0xD0
unsigned char _hours, _minutes, _seconds;
void rtcSetSeconds(unsigned char seconds)
{
_seconds = seconds;
}
void rtcSetMinutes(unsigned char minutes)... |
C | #include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include "cenString.h"
bool stringEquals(const char* s1, const char* s2) {
int comparison = strcmp(s1, s2);
return (comparison == 0);
}
// TODO : Add Unit Test
bool fixedCharArrayEquals(FixedCharArray* fixedCharArray1, FixedCharArray*... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "network.h"
#include <unistd.h>
#define PORT 7990
int main(void){
int sockfd, new_sockfd; //listen on sock_fd, new connection on new_fd
struct sockaddr_in host_addr, clien... |
C | #include<stdio.h>
#include<stdlib.h>
int main(void)
{
int N, *A=NULL, X;
scanf("%d %d", &N, &X);
A=(int *)malloc(N*sizeof(int));
for(int i=0;i<N;i++)
{
scanf("%d", &A[i]);
if(A[i]<X)
printf("%d ", A[i]);
}
printf("\n");
free(A);
return 0;
}
|
C | #include "error.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
int rand_num(int a, int b) {
return (rand() % (b-a+1)) + a;
}
int main(int argc, char *argv[]) {
srand(time(0));
if(argc != 5) {
gen_error("wrong number of arguments, [file pmin pmax bytes]\n");
... |
C | #include <string.h>
int chcount( const char *str, const char ch )
{
if ( str == NULL || strlen( str ) <= 0 )
return 0;
int c = 0;
while ( *str != '\x00' ) {
if ( *str++ == ch ) c++;
}
return c;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main(void)
{
int fd = 0;
if (access("fifo", F_OK) == 0)
{
remove("fifo");
}
//创建一个有名管道
fd = mkfifo("fifo", 0644);
if (fd < 0)
{
perror("mk... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_comb2.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char *kmp_search(const char *text, const char *pattern)
{
int *T;
int i, j;
const char *result = NULL;
if (pattern[0] == '\0')
return text;
/* Construct the lookup table */
T = (int*) malloc((strlen(patte... |
C | #include <stdio.h>
#include <stdlib.h>
// Use Variable-Length Array
int main(void)
{
int row, col, i, j;
char stat = 'a';
scanf("%d %d", &row, &col);
getchar();
char(* pch)[col] = (char (*)[col])malloc(row * col * sizeof(char));
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j+... |
C | /**
* parse.c
* The parser parses these symbols <, >, |, &.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "parse.h"
#include <ctype.h>
char** split(char *cmdline, char * delim) {
char **tokens = (char **) malloc(MAX_TOKENS * sizeof(char*));
int i;
for (i = 0; i < MAX_TOKENS; i++) {... |
C | #include <stdio.h>
int main (void)
{
printf (" n\t n^2\n-----------------\n");
int n, n_sqr;
for (n = 1; n <= 10; ++n)
{
n_sqr = n * n;
printf ("%3i\t%3i\n", n, n_sqr);
};
return 0;
} |
C | #include<stdio.h>
void quicksort(int [], int,int );
int main()
{
int list[50];
int size, i;
printf("Enter the number of elements: ");
scanf("%d",&size);
printf("Enter the elements to be sorted:\n");
for(i=0; i<size; i++)
{
scanf("%d",&list[i]);
}
quicksort(list,0,size-1);
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* unsignednbr_tobase.c :+: :+: :+: ... |
C | /** @file cpb.h
*
* Simple C protocol buffers (cpb).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applic... |
C | /*
** EPITECH PROJECT, 2018
** libmy
** File description:
** capture.c
*/
#include "my/regex.h"
static bool append(char ***oldp, size_t *n, char **sp, regmatch_t *match)
{
size_t spanlen = 0;
char **new = my_realloc(*oldp, sizeof(char *) * ((*n) + 2));
if (!new)
return (false);
spanlen = match->rm_eo - match->... |
C | /*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2016 Intel Corporation.
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
#include "ms5803.h"
#... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* process_game.c :+: :+: :+: ... |
C | /*
Xiaorans-MacBook-Air:~ xiaoranma$ cd /cc
Xiaorans-MacBook-Air:cc xiaoranma$ gcc hello.c
Xiaorans-MacBook-Air:cc xiaoranma$ ./a.out
*/
#include <stdio.h>
/*当fahr = 0, 20, ... , 300时
分别打印华氏温度与摄氏温度对照表*/
int main()
{
int fahr, celsius;
int lower, upper, step;
lower = 0; /*温度下限*/
upper = 300; /*温度上限*/
step = ... |
C | #include<stdio.h>
int main()
{
int i=10;
int *p;
p=&i;
printf("%p\n",p);
printf("%p\n",&p);
printf("%d\n",*p);
printf("%p\n",&*p);
printf("%p\n",*&p);
printf("%p\n",&(*p));
printf("%p\n",*(&p));
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
main(int argc,char **argv)
{
FILE *fp;
int size,i;
char *buf;
if(argc!=3)
{
printf("enter source and target file\n");
return;
}
fp=fopen(argv[1],"r");
if(fp==NULL)
{
printf("source file not exist\n");
return;
}
fseek(fp,0,2);
size=ftell(fp);
rewind(fp);
buf=c... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include<math.h>
#include<stdlib.h>
#define dim 100
#define len 20
typedef struct {
char lezione[len];
char prof[len];
int cred;
}corso;
typedef struct {
char prof[len];
int paga;
}stip;
void stampa(stip registro[], int n) {
int i;
printf("r... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include<math.h>
int main()
{
unsigned int MyAddress_w = 192, MyAddress_x = 168, MyAddress_y = 129, MyAddress_z = 10, adresse = 0, adresse_reseau = 0, adresse_broadcast; /* variables pour la gestion d adresse */
unsigned long long int IPv4MaskLenght = pow(2... |
C | #include <stdio.h>
#include <stdlib.h>
#include "IntSet.c"
#include "nfa.c"
#include "dfa.c"
int main()
{
//printf("\nDFA 1:\n");
/*char practice1[] = "ab";
char practice2[] = "abab";
char practice3[] = "abc";
char practice4[] = "das";
char practice5[] = "a";
char practice6[] = "abababa5baba";
char pr... |
C | // Projet 6 - Arnold LI - Enze WU - Shadé ALAO AFOLABI
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>
#define bound 50
#define w 0.8
/* ********* Structures ********* */
typedef struct {
int i; //position i de l'élément
int j; //position j de l'élément
double p; //v... |
C | long n;main(m){scanf("%ld%d",&n,&m);n=(n-2)*(m-2);printf("%ld",n>0?n:-n);} ./Main.c:1:8: warning: return type defaults to int [-Wimplicit-int]
long n;main(m){scanf("%ld%d",&n,&m);n=(n-2)*(m-2);printf("%ld",n>0?n:-n);}
^
./Main.c: In function main:
./Main.c:1:8: warning: type of m defaults to int [-Wimplicit-in... |
C | /*
* Copyright 2020 Scott Vokes
*
* See LICENCE for the full copyright terms.
*/
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <inttypes.h>
#include <fsm/fsm.h>
#include <adt/alloc.h>
#include <adt/hash.h>
#include <adt/stateset.h... |
C | #include <stdlib.h>
#include "KnxInterface.h"
DATA_TYPE pdu_alloc()
{
DEBUG("pdu_alloc begin\n");
DATA_TYPE pdu = (DATA_TYPE)malloc(120); // FIXME: buffer alloc
return pdu;
}
void HexDump(void *v,int len,int addr) {
int i,j,k;
char binstr[80];
char *buf = (char *)v;
for (i=0;i<len;i++) {... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int somadigit(char *x)
{
int b=0, soma=0, i;
for(i=0;i<strlen(x);i++){
b = x[i]-'0';
soma+=b;
}
return soma;
}
int somadigit2(int k)
{
int resto,somatorio;
somatorio=0;
while (k>0)
{
resto=k%10;
k=(k-resto)/10;
... |
C | /** @file
* Implementacja operacji na liście wskaźników na struktury @c PhoneForward
* stworzonych w pliku @ref phone_forward_struct.h z interfejscem w pliku
* @ref phone_forward_list.h
*
* @author Witalis Domitrz <witekdomitrz@gmail.com>
* @date 13.05.2018
*/
#include <stdlib.h>
#include <stdbool.h>
#include "... |
C | #include <stdlib.h>
#include "input_buffer.h"
typedef enum {
META_COMMAND_SUCCESS,
META_COMMAND_UNRECOGNISED_COMMAND
} MetaCommandResult;
MetaCommandResult do_meta_command(InputBuffer* input_buffer)
{
if (strcmp(input_buffer->buffer, ".exit") == 0) {
exit(EXIT_SUCCESS);
} else {
return META_COMMAND_U... |
C | /* Write a program to sort 10 numbers using quick sort. */
#include<stdio.h>
#define n 5
void quicksort(int x[n],int first,int last)
{
int i, j, pivot, temp;
if(first<last)
{
pivot=first;
i=first;
j=last;
while(i<j)
{
while(x[i]<=x[pivot]&&i<last)
{
i++;... |
C | #include "libft.h"
#include <sys/stat.h>
#include <stdlib.h>
extern char **g_env;
void free_array(char **array) {
int i;
i = 0;
while (array && *(array + i)) {
free(*(array + i));
i++;
}
free(array);
}
int file_is_exist(char *pathname) {
struct stat buf;
if (!pathname)
return (0);
if (stat(pathn... |
C | #include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
void sigroutine(int signo)
{
fprintf(stdout, "got signal %d.\n", signo);
exit(1);
}
int main(void)
{
signal(SIGTERM, sigroutine);
while (1)
sleep(10);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <cs50.h>
#include <ctype.h>
char caesar(char coin, int pre);
int main(int argc, string argv[])
{
bool code = false;
string input = "";
int inputlength;
int a = 0;
string key = "";
int keylength = 0;
do
{
if(argc != 2)
{
... |
C | /*
* usart.h
*
* Created on: 27-jan-2009
* Author: Jan
*/
#ifndef USART_H_
#define USART_H_
void USART_Init(unsigned int baudrate)
{
/* Set baud rate */
UBRR0H = (unsigned char)(baudrate>>8);
UBRR0L = (unsigned char)baudrate;
/* Enable receiver and interrupt*/
UCSR0B = (1<<RXEN0)|(1<<RXCIE0)|(1<<TXEN... |
C | #include <stdio.h>
int main() {
float somaDeDigitos(float num1, float num2);
float a, b, soma;
printf("Digite 2 numeros: ");
scanf("%d%d", &a, &b);
soma = somaDeDigitos(a, b);
printf("A soma e %d\n", soma);
return 0;
}
float somaDeDigitos(float num1, float num2) {
float valorAbsolu... |
C | /* 冒泡排序
* 与C语言库函数 qsort 使用方法相同
*/
#ifndef __CLIB_DATA_STRUCTURE_BUBBLESORT_C__
#define __CLIB_DATA_STRUCTURE_BUBBLESORT_C__
#include "swp.h"
int compare_int(const void *a,const void *b)
{ return *(int *)a - *(int *)b; }
void bubbleSort(void *base,size_t n,size_t size,
int (*compare)(const void *,const void ... |
C | #include "message_queue.h"
int mq_init(key_t key)
{
int msqid;
//Try to initialize the Message Queue
if ((msqid = msgget(key, IPC_CREAT | 0666 )) < 0)
{
perror("msgget");
exit(1);
}
printf("Created and Attached to Message Queue with MQID: %d\n", msqid);
return msqid;
}
int mq_att... |
C | /*
printint, printx macro
*/
#include "stdio.h"
#include <ctype.h>
#define printint(var) x##var
#define printx(n) printint((x##n))
int main(int argc, char const *argv[])
{
printf("%i\n", isdigit('9') );
return 0;
} |
C | /**
Copyright 2020 Bishop Bettini
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 without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sub... |
C | /* homework.c *
* insertion sorting *
* *
* *
* Created by Sergiy Ninoshvili on 15/06/2016 *
* *
* Copyright 2016 Sergiy Ninoshvili. All rights reserved. *
* */
#include <stdio.h>
#include "List.h"
#include "node.h... |
C | #include "../include/team.h"
#include <stdlib.h>
void make_empty_team(team *t, int size) {
t->ages = (int *) calloc(size, sizeof(int));
t->adjacency = (list *) malloc(size * sizeof(list));
for (int i = 0; i < size; i++)
make_empty_list(&t->adjacency[i]);
t->size = size;
}
void set_age(team *t,... |
C | //#include<bits/stdc++.h>
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("in.txt","r",stdin);
int tc;
//scanf("%d",&tc);
cin>>tc;
while(tc--)
{
char s[10];
scanf("%s",s);
if(s.length>3)
cout<<3<<endl;
else{
int count = 0... |
C | #include "helpers.h"
#include <math.h>
#include <stdio.h>
// Convert image to grayscale
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
int newcolor;
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
newcolor = round(((image[i][j].... |
C | // hollow inverted right triangle.
#include<stdio.h>
int main()
{
int i,j,n;
printf("Enter any rows:");
scanf("%d",&n);
for(i=1;i<=n;i++){
for(j=i;j<=n;j++){
if(j==i ||i==1 || j==n){
printf("*");// printing star depend on the value of j and i.
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct
{
char weekday[10];
char name[101];
struct {
int hour;
int min;
} Start;
struct {
int hour;
int min;
} End;
} TVshow;
typedef struct
{
int numShows;
char name[11];
TVshow *show... |
C | #include<stdio.h>
int main()
{
float h,m,ans;
while(scanf("%f:%2f",&h,&m)==2)
{
if(h==0&&m==0)break;
ans=h*30+(m/2)-(m*6);
if(ans<0)ans=ans*(-1);
if(ans>(360-ans))ans=360-ans;
printf("%.3f\n",ans);
}
return 0;
}
|
C | /*
* =====================================================================================
*
* Filename: hightlightAndSummary.c
*
* Description:
*
* Version: 1.0
* Created: 07/03/2011 06:16:47 PM
* Revision: none
* Compiler: gcc
*
* Author: kangle.wang (mn)... |
C | #include <stdint.h>
#include "pico/stdlib.h"
#include "pico/binary_info.h"
#include "hardware/spi.h"
const int LOW = 0;
const int HIGH = 1;
const int OUTPUT = 1;
#ifdef PICO_DEFAULT_SPI_CSN_PIN
void binkLED(int times) {
for (int i = 0; i < times; i++) {
gpio_put(PICO_DEFAULT_LED_PIN, 0);
sleep_m... |
C | #include "print_tools.h"
void print_by_byte(void *p_obj, char *src, int size){
int i = 0;
printf("%s's size is %d\n", src, size);
while(i < size){
printf("%02X,",*(((unsigned char *)p_obj)+i));
i++;
if(i == size){
printf("$\n");
}
}
}
|
C | #ifndef DEFINES_H
#define DEFINES_H
// Program states
#define STATE_INTRO 0
#define STATE_MENU 1
#define STATE_PREGAME 2
#define STATE_INGAME 3
#define STATE_GAMEOVER 4
#define STATE_HIGHSCORES 5
#define STATE_NEWHIGHSCORE 6
// Menu defines
#define MENU_ITEM_COUNT 2
#define MENU_ITEM_... |
C | #include <stdio.h>
#include <libgen.h>
typedef struct node{
char name[64]; // node's name string
char type;
struct node *child, *sibling, *parent;
}NODE;
NODE *root, *cwd, *start;
char line[128]; // for gettting user input line
char command[64], pathname[64]; // for... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print.c :+: :+: :+: ... |
C | #include "Assignment1SDD.h"
/*
#1
implement a method that creates a new package with the given values
@return a package with the given values; by default the package is not delivered
@input data for package fields
*/
package createPackage(const char* street, int streetNo, float weight, const char* contact)
{
package... |
C | #include<stdio.h>
struct list
{
struct list *node;
int data;
};
struct list *start;
void insert(int x,int pos)
{
int i;
struct list *newnode=(struct list *)malloc(sizeof(struct list));
struct list *l=start;
for(i=2;i<=pos;i++)
l=l->node;
newnode->data=x;
newnode->node=l->node;
if(pos==1)
start=newnode;
else
l->node=new... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct node
{
int data;
struct node* link;
}Node;
//typedef struct
//{
// listNode* head;
//}linkedList_h;
//
//linkedList_h* createLinkedList_h(void)
//{
// linkedList_h* L;
// L = (linkedList_h*)malloc(sizeof(linkedList_h));
// L->head = NULL;
// ... |
C | /*
* frequency.h
*
* Counter structure for counting token frequencies.
*/
#ifndef FREQUENCY_H
#define FREQUENCY_H
/*
* Structure used to count token frequencies.
*
* Example usage:
*
* FrequencyMap *fm = FM_create(3);
* FM_add(fm, "apple");
* FM_add(fm, "orange");
* FM_add(fm, "banana");
* FM_add(fm, "... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX 1000
void add(char s1[],char s2[])
{
int len1 = strlen(s1);
int len2 = strlen(s2);
int lens= (len1>len2)?(len1+1):(len2+1);
//char sum[lens] = {0};
int i,j,k,l;
int c = 0;
char *sum = (char *)malloc(sizeof(char)*lens);
/... |
C | /* storage class: (auto, register, static, extern)
* defines the scope (visibility) and life-time of var, func.
*/
// auto: default storage class for all local var
// register: define local var to be stored in a register instead of RAM
// static: instructs the compiler to keep a local var in existence
// extern: ... |
C | #include<stdio.h>
#include<math.h>
int arearectangle(int l,int b)
{
return l*b;
}
int perimeterrectangle(int l,int b)
{
return 2*(l+b);
}
int areasquare(int s)
{
return s*s;
}
int perimetersquare(int s)
{
return 4*s;
}
int arearhombus(int d1,int d2)
{
return 0.5*d1*d2;
}
int perimeterrhombus(... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char n[250];
long long int t,p,q;
gets(n);
scanf("%lld", &t);
while(t--)
{
scanf("%lld %lld", &p,&q);
if(q%p==0)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
|
C | #include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
#include<fcntl.h>
#include<error.h>
#include<stdbool.h>
#include<sys/types.h>
#include<dirent.h>
extern int errorno;
int main(int args,char**argv)
{
char*source=argv[1];
char*destination=argv[2];
int sourcelength=strlen(source);
int destile... |
C | //
// Created by Oleg Berdyshev on 3/10/20.
//
#include "parser.h"
/**
* @param mode - current mode (unquote, quote, double quote). Mutable parameter
* @param exp - expression
* @param pos - current position in the expression which will effect mode.
*/
void mx_change_mode(e_mode *mode, char *exp, int pos) {
s... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
// a helper linked list data type
typedef struct Node {
int key;
int val;
struct Node* head;
struct Node* next;
} ListNode;
// helper QueueNode linked list (implementation) class
struct QueueNode {
struct QueueNode *QueueTop;
struct ... |
C | #include <stdio.h>
int main(int argc, char** argv) {
if (argc <= 1) {
printf("usage: %s <password>\n", argv[0]);
return(-1);
}
char* pass = argv[1];
if (
(pass[0] == 'P') &&
(pass[1] == 'A') &&
(pass[2] == 'S') &&
(pass[3] == 'S') &&
(pass[4] == 'W') &&
... |
C | //---------------------------------------------------------------------------------------------
// S C O R E S . C
//
// Tudo sobre a tabela de scores - exibir, alterar, gravar...
//-------------------------------------------------------------------------------... |
C |
/**
@defgroup unicode Unicode
@section unicode_character_encodings Character Encodings
Currently supported character encodings
- _sym_utf_8; // utf-8, no bom
- _sym_utf_16; // utf-16, big-endian
- _sym_utf_16be; // utf-16, big-endian
- _sym_utf_16le; // utf-16, little-endian
- _sym_iso_8859_1; // iso-8859... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "board.h"
int validMove(disk played, disk board[SIZE][SIZE]) //checks if the move is valid. 1st checks your disk is next to opposite colour,
{ //then calls endsWithYourColour. Returns 0 if valid 1 i... |
C | /*************************************************************************
> File Name: 183.c
> Author: wangshuai
> Mail: ws1519704327@126.com
> Created Time: 2019年12月13日 星期五 18时26分59秒
************************************************************************/
#include<stdio.h>
int func(int n) {
if (... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int boleta;
int empleado;
int importe;
float importeVendedor1 = 0;
float importeVendedor2 = 0;
float importeVendedor3 = 0;
float importeFinal1;
float importeFinal2;
float importeFinal3;
int respuesta = 1;
d... |
C | /*File name: shmem.c
*Type: C source file
*Date: 2017/04/21
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sys/shm.h>
#include <string.h>
#include "shmdata.h"
#include "signal.h"
int shmid;
void *shmem_addr= NULL; //This is the start address of the shared memory
struct s... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_CITIES 101
#define INF 100000
struct Node {
int dest;
int len;
int toll;
struct Node *next;
};
struct Node roads[MAX_CITIES];
struct Node backup[MAX_CITIES*MAX_CITIES];
int visited[MAX_CITIES];
int k, n, r;
int min_len;
void
dfs(int c, int cur_le... |
C | #include "bel-ast.h"
#ifndef _BEL_NODE_STACK_H
#define _BEL_NODE_STACK_H
typedef struct {
int top;
int max;
bel_ast_node* contents[];
} bel_node_stack;
bel_node_stack* stack_init(int max);
void stack_destroy(bel_node_stack* stack);
bel_ast_node... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.